OSDN Git Service

EUC版はUTF-8に統合
[nucleus-jp/nucleus-jp-ancient.git] / euc / skins / default / nicetitle.js
diff --git a/euc/skins/default/nicetitle.js b/euc/skins/default/nicetitle.js
deleted file mode 100644 (file)
index 55c9d56..0000000
+++ /dev/null
@@ -1,448 +0,0 @@
-// from http://www.kryogenix.org\r
-// by Scott Andrew - http://scottandrew.com\r
-// add an eventlistener to browsers that can do it somehow.\r
-function addEvent(obj, evType, fn)\r
-       {\r
-       if (obj.addEventListener)\r
-               {\r
-               obj.addEventListener(evType, fn, false);\r
-               return true;\r
-               }\r
-       else if (obj.attachEvent)\r
-               {\r
-               var r = obj.attachEvent('on'+evType, fn);\r
-               return r;\r
-               }\r
-       else\r
-               {\r
-               return false;\r
-               }\r
-       }\r
-\r
-function floatImages()\r
-       {\r
-       // adapted from http://www.dithered.com/javascript/browser_detect/\r
-       //**************************************************************//\r
-       // sniff user agent\r
-       var userAgent = navigator.userAgent.toLowerCase();\r
-\r
-       // if Mozilla 1.4 then quit\r
-       if ((userAgent.indexOf('gecko') != -1) && (userAgent.indexOf('gecko/') + 14 == userAgent.length) && (parseFloat(userAgent.substring(userAgent.indexOf('rv:') + 3)) == '1.4')) return;\r
-\r
-       // if Opera then quit\r
-       if (document.all && window.Event) return;\r
-       //**************************************************************//\r
-\r
-       // check this browser can cope with what we want to do\r
-       if (!document.getElementById) return;\r
-       var blogDiv = document.getElementById('blog');\r
-       if (!blogDiv) return;\r
-       if (!blogDiv.offsetWidth) return;\r
-\r
-       blogDiv.className = (blogDiv.offsetWidth >= 500) ? "float-images" : "block-images";\r
-       }\r
-\r
-// Blockquote citations\r
-\r
-// Simon Willison's work:\r
-// http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations\r
-\r
-// Also Dunstan Orchard's work:\r
-// http://1976design.com/blog/archive/2003/11/10/updates/\r
-function blockquoteCite()\r
-       {\r
-       if (!document.createElementNS)\r
-               {\r
-               document.createElementNS = function(ns, elt)\r
-                       {\r
-                       return document.createElement(elt);\r
-                       }\r
-               }\r
-       quotes = document.getElementsByTagName('blockquote');\r
-       for (i = 0; i < quotes.length; i++)\r
-               {\r
-               var cite = quotes[i].getAttribute('cite');\r
-               // value of cite attribute should only contain URI, not any other\r
-               if ((cite) && (cite != ''))\r
-                       {\r
-                       newlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');\r
-                       newlink.setAttribute('href', cite);\r
-                       newlink.className = 'cite-link';\r
-                       newlink.appendChild(document.createTextNode(cite));\r
-                       newdiv = document.createElementNS('http://www.w3.org/1999/xhtml', 'cite');\r
-                       newdiv.className = 'blockquote-cite';\r
-                       newdiv.appendChild(document.createTextNode('Source: '));\r
-                       newdiv.appendChild(newlink);\r
-                       quotes[i].appendChild(newdiv);\r
-                       quotes[i].removeAttribute('cite');\r
-                       }\r
-               }\r
-       }\r
-\r
-// Ins and Del tags citations\r
-function insdelCite()\r
-       {\r
-       if (!document.createElementNS)\r
-               {\r
-               document.createElementNS = function(ns, elt)\r
-                       {\r
-                       return document.createElement(elt);\r
-                       }\r
-               }\r
-       var insdel = new Array(2);\r
-       insdel[0] = document.getElementsByTagName('ins');\r
-       insdel[1] = document.getElementsByTagName('del');\r
-       for (var i=0; i<insdel.length; i++)\r
-               {\r
-               if (insdel[i])\r
-                       {\r
-                       for (var id=0; id<insdel[i].length; id++)\r
-                               {\r
-                               var isdl = insdel[i][id].getAttribute('cite');\r
-                               if ((isdl) && (isdl != ""))\r
-                                       {\r
-                                       idlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');\r
-                                       idlink.setAttribute('href', isdl);\r
-                                       idlink.className = 'cite-link ' + (i == 0 ? 'ins-cite' : 'del-cite');\r
-                                       idlink.setAttribute('title','citation of ' + (i == 0 ? 'added' : 'deleted') + ' text');\r
-                                       idlink.appendChild(document.createTextNode('#'));\r
-                                       insdel[i][id].appendChild(idlink);\r
-                                       insdel[i][id].removeAttribute('cite');\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-// Force IE not to show alternate text as tooltip\r
-function noAltTooltip()\r
-       {\r
-       images = document.getElementsByTagName('img');\r
-       for (var i = 0; i < images.length; i++)\r
-               {\r
-               var title = images[i].getAttribute('title');\r
-               var alt = images[i].getAttribute('alt');\r
-               if ((document.all) && (alt) && (!title))\r
-                       {\r
-                       images[i].setAttribute('title', '');\r
-                       }\r
-               }\r
-       }\r
-\r
-// Nice Titles\r
-\r
-// original code by Stuart Langridge 2003-11\r
-// with additions to the code by other good people\r
-// http://www.kryogenix.org/code/browser/nicetitle/\r
-// thank you, sir\r
-\r
-// modified by Peter Janes 2003-03-25\r
-// http://peterjanes.ca/blog/archives/2003/03/25/nicetitles-for-ins-and-del\r
-// added in ins and del tags\r
-\r
-// modified by Dunstan Orchard 2003-11-18\r
-// http://1976design.com/blog/\r
-// added in accesskey information\r
-// tried ever-so-hard, but couldn't work out how to do what Ethan did\r
-\r
-// final genius touch by by Ethan Marcotte 2003-11-18\r
-// http://www.sidesh0w.com/\r
-// worked out how to delay showing the popups to make them more like the browser's own\r
-\r
-// set the namespace\r
-var XHTMLNS = 'http://www.w3.org/1999/xhtml';\r
-var CURRENT_NICE_TITLE;\r
-\r
-// browser sniff\r
-var browser = new Browser();\r
-\r
-// determine browser and version.\r
-function Browser()\r
-       {\r
-       var ua, s, i;\r
-\r
-       this.isIE = false;\r
-       this.isNS = false;\r
-       this.version = null;\r
-\r
-       ua = navigator.userAgent;\r
-\r
-       s = 'MSIE';\r
-       if ((i = ua.indexOf(s)) >= 0)\r
-               {\r
-               this.isIE = true;\r
-               this.version = parseFloat(ua.substr(i + s.length));\r
-               return;\r
-               }\r
-\r
-       s = 'Netscape6/';\r
-       if ((i = ua.indexOf(s)) >= 0)\r
-               {\r
-               this.isNS = true;\r
-               this.version = parseFloat(ua.substr(i + s.length));\r
-               return;\r
-               }\r
-\r
-       // treat any other 'Gecko' browser as NS 6.1.\r
-       s = 'Gecko';\r
-       if ((i = ua.indexOf(s)) >= 0)\r
-               {\r
-               this.isNS = true;\r
-               this.version = 6.1;\r
-               return;\r
-               }\r
-       }\r
-\r
-// 2003-11-19 sidesh0w\r
-// set delay vars to emulate normal hover delay\r
-var delay;\r
-var interval = 0.60;\r
-\r
-// this function runs on window load\r
-// it runs through all the links on the page as starts listening for actions\r
-function makeNiceTitles()\r
-       {\r
-       if (!document.createElement || !document.getElementsByTagName) return;\r
-       if (!document.createElementNS)\r
-               {\r
-               document.createElementNS = function(ns, elt)\r
-                       {\r
-                       return document.createElement(elt);\r
-                       }\r
-               }\r
-\r
-       // do regular links\r
-       if (!document.links)\r
-               {\r
-               document.links = document.getElementsByTagName('a');\r
-               }\r
-       for (var ti=0; ti<document.links.length; ti++)\r
-               {\r
-               var lnk = document.links[ti];\r
-               // * I added specific class names here..\r
-               if (lnk.title)\r
-                       {\r
-                       lnk.setAttribute('nicetitle', lnk.title);\r
-                       lnk.removeAttribute('title');\r
-                       addEvent(lnk, 'mouseover', showDelay);\r
-                       addEvent(lnk, 'mouseout', hideNiceTitle);\r
-                       addEvent(lnk, 'focus', showDelay);\r
-                       addEvent(lnk, 'blur', hideNiceTitle);\r
-                       }\r
-               }\r
-\r
-       // 2003-03-25 Peter Janes\r
-       // do ins and del tags\r
-       var tags = new Array(2);\r
-       tags[0] = document.getElementsByTagName('ins');\r
-       tags[1] = document.getElementsByTagName('del');\r
-       for (var tt=0; tt<tags.length; tt++)\r
-               {\r
-               if (tags[tt])\r
-                       {\r
-                       for (var ti=0; ti<tags[tt].length; ti++)\r
-                               {\r
-                               var tag = tags[tt][ti];\r
-                               if (tag.dateTime)\r
-                                       {\r
-                                       var strDate = tag.dateTime;\r
-                                       // HTML/ISO8601 date: yyyy-mm-ddThh:mm:ssTZD (Z, -hh:mm, +hh:mm)\r
-                                       var month = strDate.substring(5,7);\r
-                                       var day = strDate.substring(8,10);\r
-                                       if (month[0] == '0')\r
-                                               {\r
-                                               month = month[1];\r
-                                               }\r
-                                       if (day[0] == '0')\r
-                                               {\r
-                                               day = day[1];\r
-                                               }\r
-                                       var dtIns = new Date(strDate.substring(0,4), month-1, day, strDate.substring(11,13), strDate.substring(14,16), strDate.substring(17,19));\r
-                                       tag.setAttribute('nicetitle', (tt == 0 ? 'Added' : 'Deleted') + ' on ' + dtIns.toString());\r
-                                       addEvent(tag, 'mouseover', showDelay);\r
-                                       addEvent(tag, 'mouseout', hideNiceTitle);\r
-                                       addEvent(tag, 'focus', showDelay);\r
-                                       addEvent(tag, 'blur', hideNiceTitle);\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-function findPosition(oLink)\r
-       {\r
-       if (oLink.offsetParent)\r
-               {\r
-               for (var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent)\r
-                       {\r
-                       posX += oLink.offsetLeft;\r
-                       posY += oLink.offsetTop;\r
-                       }\r
-               return [posX, posY];\r
-               }\r
-       else\r
-               {\r
-               return [oLink.x, oLink.y];\r
-               }\r
-       }\r
-\r
-function getParent(el, pTagName)\r
-       {\r
-       if (el == null)\r
-               {\r
-               return null;\r
-               }\r
-       // gecko bug, supposed to be uppercase\r
-       else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())\r
-               {\r
-               return el;\r
-               }\r
-       else\r
-               {\r
-               return getParent(el.parentNode, pTagName);\r
-               }\r
-       }\r
-\r
-// 2003-11-19 sidesh0w\r
-// trailerpark wrapper function\r
-function showDelay(e)\r
-       {\r
-    if (window.event && window.event.srcElement)\r
-               {\r
-        lnk = window.event.srcElement\r
-               }\r
-       else if (e && e.target)\r
-               {\r
-        lnk = e.target\r
-               }\r
-    if (!lnk) return;\r
-\r
-       // lnk is a textnode or an elementnode that's not ins/del\r
-    if (lnk.nodeType == 3 || (lnk.nodeType == 1 && lnk.tagName.toLowerCase() != 'ins' && lnk.tagName.toLowerCase() != 'del'))\r
-               {\r
-               // ascend parents until we hit a link\r
-               lnk = getParent(lnk, 'a');\r
-               }\r
-\r
-       delay = setTimeout("showNiceTitle(lnk)", interval * 1000);\r
-       }\r
-\r
-// build and show the nice titles\r
-function showNiceTitle(link)\r
-       {\r
-    if (CURRENT_NICE_TITLE) hideNiceTitle(CURRENT_NICE_TITLE);\r
-    if (!document.getElementsByTagName) return;\r
-\r
-    nicetitle = lnk.getAttribute('nicetitle');\r
-\r
-    var d = document.createElementNS(XHTMLNS, 'div');\r
-    d.className = 'nicetitle';\r
-    var dc = document.createElementNS(XHTMLNS, 'div');\r
-    dc.className = 'nicetitle-content';\r
-    d.appendChild(dc);\r
-    tnt = document.createTextNode(nicetitle);\r
-    pat = document.createElementNS(XHTMLNS, 'p');\r
-    pat.className = 'titletext';\r
-    pat.appendChild(tnt);\r
-\r
-       // 2003-11-18 Dunstan Orchard\r
-       // added in accesskey info\r
-       if (lnk.accessKey)\r
-               {\r
-        axs = document.createTextNode(' [' + lnk.accessKey + ']');\r
-               axsk = document.createElementNS(XHTMLNS, 'span');\r
-        axsk.className = 'accesskey';\r
-        axsk.appendChild(axs);\r
-               pat.appendChild(axsk);\r
-               }\r
-    dc.appendChild(pat);\r
-\r
-    if (lnk.href)\r
-               {\r
-        tnd = document.createTextNode(lnk.href);\r
-        pad = document.createElementNS(XHTMLNS, 'p');\r
-        pad.className = 'destination';\r
-        pad.appendChild(tnd);\r
-        dc.appendChild(pad);\r
-               }\r
-\r
-    STD_WIDTH = 300;\r
-\r
-       if (lnk.href)\r
-               {\r
-        h = lnk.href.length;\r
-               }\r
-       else\r
-               {\r
-               h = nicetitle.length;\r
-               }\r
-\r
-    if (nicetitle.length)\r
-               {\r
-               t = nicetitle.length;\r
-               }\r
-\r
-    h_pixels = h*6;\r
-       t_pixels = t*10;\r
-\r
-    if (h_pixels > STD_WIDTH)\r
-               {\r
-        w = h_pixels;\r
-               }\r
-       else if ((STD_WIDTH>t_pixels) && (t_pixels>h_pixels))\r
-               {\r
-        w = t_pixels;\r
-               }\r
-       else if ((STD_WIDTH>t_pixels) && (h_pixels>t_pixels))\r
-               {\r
-        w = h_pixels;\r
-               }\r
-       else\r
-               {\r
-        w = STD_WIDTH;\r
-               }\r
-\r
-    d.style.width = w + 'px';\r
-\r
-    mpos = findPosition(lnk);\r
-    mx = mpos[0];\r
-    my = mpos[1];\r
-\r
-    d.style.left = (mx+15) + 'px';\r
-    d.style.top = (my+35) + 'px';\r
-\r
-    if (window.innerWidth && ((mx+w) > window.innerWidth))\r
-               {\r
-        d.style.left = (window.innerWidth - w - 25) + 'px';\r
-               }\r
-    if (document.body.scrollWidth && ((mx+w) > document.body.scrollWidth))\r
-               {\r
-        d.style.left = (document.body.scrollWidth - w - 25) + 'px';\r
-               }\r
-\r
-    document.getElementsByTagName('body')[0].appendChild(d);\r
-\r
-    CURRENT_NICE_TITLE = d;\r
-       }\r
-\r
-function hideNiceTitle(e)\r
-       {\r
-       // 2003-11-19 sidesh0w\r
-       // clearTimeout\r
-       if (delay) clearTimeout(delay);\r
-       if (!document.getElementsByTagName) return;\r
-       if (CURRENT_NICE_TITLE)\r
-               {\r
-               document.getElementsByTagName('body')[0].removeChild(CURRENT_NICE_TITLE);\r
-               CURRENT_NICE_TITLE = null;\r
-               }\r
-       }\r
-\r
-addEvent(window, "load", floatImages);\r
-addEvent(window, "resize", floatImages);\r
-addEvent(window, "load", blockquoteCite);\r
-addEvent(window, "load", insdelCite);\r
-addEvent(window, "load", noAltTooltip);\r
-addEvent(window, "load", makeNiceTitles);\r
-\r
-// I'm very poor in JavaScript. Please correct me if I'm wrong.
\ No newline at end of file