From 61943d3490aff7cfc57c8e091d47f094fc4af991 Mon Sep 17 00:00:00 2001 From: reine Date: Mon, 28 May 2012 00:36:32 +0900 Subject: [PATCH] =?utf8?q?FIX:=E3=83=9A=E3=83=BC=E3=82=B8=E3=82=92?= =?utf8?q?=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB=E3=81=97=E3=81=A6?= =?utf8?q?=E3=81=84=E3=82=8B=E7=8A=B6=E6=85=8B=E3=81=A7=E3=81=AE=E5=8B=95?= =?utf8?q?=E4=BD=9C=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/default/nicetitle.js | 956 ++++++++++++++++++++++----------------------- 1 file changed, 478 insertions(+), 478 deletions(-) diff --git a/skins/default/nicetitle.js b/skins/default/nicetitle.js index c8f073f..3ad5f4a 100644 --- a/skins/default/nicetitle.js +++ b/skins/default/nicetitle.js @@ -1,478 +1,478 @@ -// from http://www.kryogenix.org -// by Scott Andrew - http://scottandrew.com -// add an eventlistener to browsers that can do it somehow. -function addEvent(obj, evType, fn) - { - if (obj.addEventListener) - { - obj.addEventListener(evType, fn, false); - return true; - } - else if (obj.attachEvent) - { - var r = obj.attachEvent('on'+evType, fn); - return r; - } - else - { - return false; - } - } - -function floatImages() - { - // adapted from http://www.dithered.com/javascript/browser_detect/ - //**************************************************************// - // sniff user agent - var userAgent = navigator.userAgent.toLowerCase(); - - // if Mozilla 1.4 then quit - if ((userAgent.indexOf('gecko') != -1) && (userAgent.indexOf('gecko/') + 14 == userAgent.length) && (parseFloat(userAgent.substring(userAgent.indexOf('rv:') + 3)) == '1.4')) return; - - // if Opera then quit - if (document.all && window.Event) return; - //**************************************************************// - - // check this browser can cope with what we want to do - if (!document.getElementById) return; - var blogDiv = document.getElementById('blog'); - if (!blogDiv) return; - if (!blogDiv.offsetWidth) return; - - blogDiv.className = (blogDiv.offsetWidth >= 500) ? "float-images" : "block-images"; - } - -// Blockquote citations - -// Simon Willison's work: -// http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations - -// Also Dunstan Orchard's work: -// http://1976design.com/blog/archive/2003/11/10/updates/ -function blockquoteCite() - { - if (!document.createElementNS) - { - document.createElementNS = function(ns, elt) - { - return document.createElement(elt); - } - } - quotes = document.getElementsByTagName('blockquote'); - for (i = 0; i < quotes.length; i++) - { - var cite = quotes[i].getAttribute('cite'); - // value of cite attribute should only contain URI, not any other - if ((cite) && (cite != '')) - { - newlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); - newlink.setAttribute('href', cite); - newlink.className = 'cite-link'; - newlink.appendChild(document.createTextNode(cite)); - newdiv = document.createElementNS('http://www.w3.org/1999/xhtml', 'cite'); - newdiv.className = 'blockquote-cite'; - newdiv.appendChild(document.createTextNode('Source: ')); - newdiv.appendChild(newlink); - quotes[i].appendChild(newdiv); - quotes[i].removeAttribute('cite'); - } - } - } - -// Ins and Del tags citations -function insdelCite() - { - if (!document.createElementNS) - { - document.createElementNS = function(ns, elt) - { - return document.createElement(elt); - } - } - var insdel = new Array(2); - insdel[0] = document.getElementsByTagName('ins'); - insdel[1] = document.getElementsByTagName('del'); - for (var i=0; i= 0) - { - this.isIE = true; - this.version = parseFloat(ua.substr(i + s.length)); - return; - } - - s = 'Netscape6/'; - if ((i = ua.indexOf(s)) >= 0) - { - this.isNS = true; - this.version = parseFloat(ua.substr(i + s.length)); - return; - } - - // treat any other 'Gecko' browser as NS 6.1. - s = 'Gecko'; - if ((i = ua.indexOf(s)) >= 0) - { - this.isNS = true; - this.version = 6.1; - return; - } - } - -// 2003-11-19 sidesh0w -// set delay vars to emulate normal hover delay -var delay; -var interval = 0.60; - -// this function runs on window load -// it runs through all the links on the page as starts listening for actions -function makeNiceTitles() - { - if (!document.createElement || !document.getElementsByTagName) return; - if (!document.createElementNS) - { - document.createElementNS = function(ns, elt) - { - return document.createElement(elt); - } - } - - // do regular links - if (!document.links) - { - document.links = document.getElementsByTagName('a'); - } - for (var ti=0; ti STD_WIDTH) - { - w = t_pixels; - } - else if ((STD_WIDTH > t_pixels) && (t_pixels > h_pixels)) - { - w = t_pixels; - } - else if ((STD_WIDTH > h_pixels) && (h_pixels > t_pixels)) - { - w = h_pixels; - } - else - { - w = STD_WIDTH; - } - - d.style.width = w + 'px'; - d.style.display = 'none'; - - document.getElementsByTagName('body')[0].appendChild(d); - - CURRENT_NICE_TITLE = d; - - moveNiceTitle(e); - - delay = setTimeout("showDelay()", interval * 1000); - } - -function moveNiceTitle(e) - { - if (!document.getElementsByTagName) return; - if (!CURRENT_NICE_TITLE) return; - - if (document.all) - { - X = document.body.scrollLeft + window.event.clientX; - } - else if (document.layers || document.getElementById) - { - X = e.pageX; - } - w_title = Number(CURRENT_NICE_TITLE.style.width.replace(/^(\d+).*$/, '$1')); - if (w_title + X > (window.innerWidth - 20)) - { - X = window.innerWidth - w_title - 20; - } - - if (document.all) - { - Y = document.body.scrollTop + window.event.clientY; - } - else if (document.layers || document.getElementById) - { - Y = e.pageY; - } - if (Y > (window.innerHeight - 60)) - { - Y = Y - 25 - 60; - } - - CURRENT_NICE_TITLE.style.left = X + 'px'; - CURRENT_NICE_TITLE.style.top = (Y + 25) + 'px'; - } - -function hideNiceTitle(e) - { - // 2003-11-19 sidesh0w - // clearTimeout - if (delay) clearTimeout(delay); - if (!document.getElementsByTagName) return; - if (CURRENT_NICE_TITLE) - { - document.getElementsByTagName('body')[0].removeChild(CURRENT_NICE_TITLE); - CURRENT_NICE_TITLE = null; - } - } - -addEvent(window, "load", floatImages); -addEvent(window, "resize", floatImages); -addEvent(window, "load", blockquoteCite); -addEvent(window, "load", insdelCite); -addEvent(window, "load", noAltTooltip); -addEvent(window, "load", makeNiceTitles); - -// I'm very poor in JavaScript. Please correct me if I'm wrong. +// from http://www.kryogenix.org +// by Scott Andrew - http://scottandrew.com +// add an eventlistener to browsers that can do it somehow. +function addEvent(obj, evType, fn) + { + if (obj.addEventListener) + { + obj.addEventListener(evType, fn, false); + return true; + } + else if (obj.attachEvent) + { + var r = obj.attachEvent('on'+evType, fn); + return r; + } + else + { + return false; + } + } + +function floatImages() + { + // adapted from http://www.dithered.com/javascript/browser_detect/ + //**************************************************************// + // sniff user agent + var userAgent = navigator.userAgent.toLowerCase(); + + // if Mozilla 1.4 then quit + if ((userAgent.indexOf('gecko') != -1) && (userAgent.indexOf('gecko/') + 14 == userAgent.length) && (parseFloat(userAgent.substring(userAgent.indexOf('rv:') + 3)) == '1.4')) return; + + // if Opera then quit + if (document.all && window.Event) return; + //**************************************************************// + + // check this browser can cope with what we want to do + if (!document.getElementById) return; + var blogDiv = document.getElementById('blog'); + if (!blogDiv) return; + if (!blogDiv.offsetWidth) return; + + blogDiv.className = (blogDiv.offsetWidth >= 500) ? "float-images" : "block-images"; + } + +// Blockquote citations + +// Simon Willison's work: +// http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations + +// Also Dunstan Orchard's work: +// http://1976design.com/blog/archive/2003/11/10/updates/ +function blockquoteCite() + { + if (!document.createElementNS) + { + document.createElementNS = function(ns, elt) + { + return document.createElement(elt); + } + } + quotes = document.getElementsByTagName('blockquote'); + for (i = 0; i < quotes.length; i++) + { + var cite = quotes[i].getAttribute('cite'); + // value of cite attribute should only contain URI, not any other + if ((cite) && (cite != '')) + { + newlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); + newlink.setAttribute('href', cite); + newlink.className = 'cite-link'; + newlink.appendChild(document.createTextNode(cite)); + newdiv = document.createElementNS('http://www.w3.org/1999/xhtml', 'cite'); + newdiv.className = 'blockquote-cite'; + newdiv.appendChild(document.createTextNode('Source: ')); + newdiv.appendChild(newlink); + quotes[i].appendChild(newdiv); + quotes[i].removeAttribute('cite'); + } + } + } + +// Ins and Del tags citations +function insdelCite() + { + if (!document.createElementNS) + { + document.createElementNS = function(ns, elt) + { + return document.createElement(elt); + } + } + var insdel = new Array(2); + insdel[0] = document.getElementsByTagName('ins'); + insdel[1] = document.getElementsByTagName('del'); + for (var i=0; i= 0) + { + this.isIE = true; + this.version = parseFloat(ua.substr(i + s.length)); + return; + } + + s = 'Netscape6/'; + if ((i = ua.indexOf(s)) >= 0) + { + this.isNS = true; + this.version = parseFloat(ua.substr(i + s.length)); + return; + } + + // treat any other 'Gecko' browser as NS 6.1. + s = 'Gecko'; + if ((i = ua.indexOf(s)) >= 0) + { + this.isNS = true; + this.version = 6.1; + return; + } + } + +// 2003-11-19 sidesh0w +// set delay vars to emulate normal hover delay +var delay; +var interval = 0.60; + +// this function runs on window load +// it runs through all the links on the page as starts listening for actions +function makeNiceTitles() + { + if (!document.createElement || !document.getElementsByTagName) return; + if (!document.createElementNS) + { + document.createElementNS = function(ns, elt) + { + return document.createElement(elt); + } + } + + // do regular links + if (!document.links) + { + document.links = document.getElementsByTagName('a'); + } + for (var ti=0; ti STD_WIDTH) + { + w = t_pixels; + } + else if ((STD_WIDTH > t_pixels) && (t_pixels > h_pixels)) + { + w = t_pixels; + } + else if ((STD_WIDTH > h_pixels) && (h_pixels > t_pixels)) + { + w = h_pixels; + } + else + { + w = STD_WIDTH; + } + + d.style.width = w + 'px'; + d.style.display = 'none'; + + document.getElementsByTagName('body')[0].appendChild(d); + + CURRENT_NICE_TITLE = d; + + moveNiceTitle(e); + + delay = setTimeout("showDelay()", interval * 1000); + } + +function moveNiceTitle(e) + { + if (!document.getElementsByTagName) return; + if (!CURRENT_NICE_TITLE) return; + + if (document.all) + { + X = document.body.scrollLeft + window.event.clientX; + } + else if (document.layers || document.getElementById) + { + X = e.pageX; + } + w_title = Number(CURRENT_NICE_TITLE.style.width.replace(/^(\d+).*$/, '$1')); + if (w_title + X > (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20)) + { + X = (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20) - w_title; + } + + if (document.all) + { + Y = document.body.scrollTop + window.event.clientY; + } + else if (document.layers || document.getElementById) + { + Y = e.pageY; + } + if (Y > (window.innerHeight + (document.documentElement.scrollTop || window.pageYOffset) - 60)) + { + Y = Y - 25 - 60; + } + + CURRENT_NICE_TITLE.style.left = X + 'px'; + CURRENT_NICE_TITLE.style.top = (Y + 25) + 'px'; + } + +function hideNiceTitle(e) + { + // 2003-11-19 sidesh0w + // clearTimeout + if (delay) clearTimeout(delay); + if (!document.getElementsByTagName) return; + if (CURRENT_NICE_TITLE) + { + document.getElementsByTagName('body')[0].removeChild(CURRENT_NICE_TITLE); + CURRENT_NICE_TITLE = null; + } + } + +addEvent(window, "load", floatImages); +addEvent(window, "resize", floatImages); +addEvent(window, "load", blockquoteCite); +addEvent(window, "load", insdelCite); +addEvent(window, "load", noAltTooltip); +addEvent(window, "load", makeNiceTitles); + +// I'm very poor in JavaScript. Please correct me if I'm wrong. -- 2.11.0