Advertisement
Guest User

Untitled

a guest
Sep 26th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:void( (function() {
  2.     var d= new Date(); var e=document.createElement('script'); e.setAttribute('type','text/javascript'); e.setAttribute('charset','utf-8'); /** import start**/ (function() {
  3.         var w = window; var d = w.document; w.setEventHandler=(function() {
  4.             if (w.addEventListener) {
  5.                 return function(obj,evt,handler) {
  6.                     obj.addEventListener(evt,handler,false)}
  7.  
  8.                 ; }
  9.  
  10.             else if (w.attachEvent) {
  11.                 return function(obj,evt,handler) {
  12.                     obj.attachEvent('on'+evt,handler)}
  13.  
  14.                 ; }
  15.  
  16.             else {
  17.                 return function(obj,evt,handler) {
  18.                     var org=obj['on'+evt];obj['on'+evt]=function() {
  19.                         if(typeof org=='function')org();handler()}
  20.                 }
  21.  
  22.                 ; }
  23.         }
  24.  
  25.         )(); if(true) {
  26.             /*******************/ w.setMouseHandler=function(obj, evt, handler) {
  27.                 var mouseHandler=function(curEvent,e) {
  28.                     if (!e) e=w.event; if (!e) return; var prop=obj._MouseProp_; var curStatus=prop.status; if (curStatus==curEvent) return; if (curStatus=='out') {
  29.                         /*  outer to inner */ var fncArrayOver=prop.fncArrayOver; for (var ci=0,len=fncArrayOver.length; ci<len; ci++) {
  30.                             fncArrayOver[ci].apply(obj,[e]); }
  31.                     }
  32.  
  33.                     else {
  34.                         /*  inner to outer */ var chkNode=e.toElement||e.relatedTarget; while (chkNode) {
  35.                             if (chkNode==obj) return; chkNode=chkNode.parentNode; }
  36.  
  37.                         var fncArrayOut=prop.fncArrayOut; for (var ci=0,len=fncArrayOut.length; ci<len; ci++) {
  38.                             fncArrayOut[ci].apply(obj,[e]); }
  39.                     }
  40.  
  41.                     prop.status=curEvent; }
  42.  
  43.                 ; var prop=obj._MouseProp_; if (!prop) {
  44.                     prop=obj._MouseProp_= {
  45.                         status: 'out',fncArrayOver:[],fncArrayOut:[]
  46.                     }
  47.  
  48.                     ; w.setEventHandler(obj,'mouseover',function(e) {
  49.                         mouseHandler('over',e)}
  50.  
  51.                     ); w.setEventHandler(obj,'mouseout',function(e) {
  52.                         mouseHandler('out',e)}
  53.  
  54.                     ); }
  55.  
  56.                 if (evt=='mouseover') {
  57.                     prop.fncArrayOver[prop.fncArrayOver.length]=handler; }
  58.  
  59.                 else if (evt=='mouseout') {
  60.                     prop.fncArrayOut[prop.fncArrayOut.length]=handler; }
  61.  
  62.                 else {
  63.                     w.setEventHandler(obj,evt,handler); }
  64.             }
  65.  
  66.             ; /*******************/ }
  67.     }
  68.  
  69.     )(); function Found() {
  70.         this.initialize.apply(this, arguments); }
  71.  
  72.     Found.prototype = {
  73.         host: 'okinny.heypo.net', endPointPath: '/image/post', imageUrlDir: '/images', linkRegExp: /\.(jpe?g|png|gif)/i, banSize: {
  74.             regular: 300, thumbnail: 150
  75.         }
  76.  
  77.         , postStyle: {
  78.             id: '__found_overlay', borderWidth: 5, color: '#006699', hoverColor: '#000'
  79.         }
  80.  
  81.         , dialogStyle: {
  82.             width: 250, height: 50, color: '#fff', anchorColor: '#fff', backgroundColor: '#000'
  83.         }
  84.  
  85.         , t: 0, appendedUrls: {
  86.  
  87.         }
  88.  
  89.         , initialize: function() {
  90.             this.endPoint = 'http://' + this.host + this.endPointPath;
  91.             this.imageUrl = 'http://' + this.host + this.imageUrlDir; this.w = window; if(0 < document.getElementsByTagName('frame').length) {
  92.                 this.d=window[0].document; }
  93.  
  94.             else {
  95.                 this.d=document; }
  96.  
  97.             this.hide(document.body); this.post = this.d.getElementById(this.postStyle.id); if (!this.post) {
  98.                 this.post = this.d.createElement('div'); this.post.style.display = 'none'; this.post.style.fontFamily = "'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック',sans-serif"; this.post.style.position = 'absolute'; this.post.style.zIndex = '250'; this.post.style.backgroundColor = 'transparent'; this.post.style.backgroundImage = 'url(' + this.imageUrl + '/post_bg.gif)'; this.post.style.top = '0px'; this.dialog = this.d.createElement('div'); this.dialog.style.position = 'absolute'; this.dialog.style.zIndex = '250'; this.dialog.style.textAlign = 'center'; this.dialog.style.width = this.dialogStyle.width + 'px'; this.dialog.style.height = this.dialogStyle.height + 'px'; this.dialog.style.color = this.dialogStyle.color; this.dialog.style.backgroundColor = this.dialogStyle.backgroundColor; this.add_image = this.d.createElement('a'); this.add_image.href = '#'; this.add_image.style.color = this.dialogStyle.anchorColor; this.add_image.style.fontSize = '14px'; this.add_image.style.paddingLeft = '20px'; this.add_image.style.background = 'url(' + this.imageUrl + '/back_okn.gif) no-repeat 0% 50%'; this.add_image.style.position = 'absolute'; this.add_image.style.left = '20px'; this.add_image.style.top = '15px'; if(false) {
  99.                     /*******************/ this.add_image.appendChild(this.d.createTextNode('この画像をOkinnyに登録する')); this.dialog.appendChild(this.add_image); this.post.appendChild(this.dialog); this.d.body.appendChild(this.post); this.w.setMouseHandler(this.post, 'mouseout', function() {
  100.                         this.style.display = 'none'; }
  101.  
  102.                     ); /*******************/ }
  103.  
  104.                 var area = document.createElement('div'); area.style.display = 'block'; area.style.position = 'absolute'; area.style.top = 0; area.style.left = 0; area.style.textAlign = 'center'; area.style.width = '100%'; area.style.backgroundColor = '#000000'; document.body.appendChild(area); document.body.style.display = 'block'; var back = document.createElement('p'); back.innerHTML = '<a href="' + location.href + '" style="color:#01C0FF;">元のページに戻る</a>'; back.style.display = 'block'; back.style.padding = '5px'; back.style.position = 'fixed'; back.style.top = '3px'; back.style.left = '3px'; back.style.fontSize = '12px'; back.style.fontSize = '12px'; back.style.fontWeight = 'normal'; back.style.lineHeight = '120%'; back.style.fontFamily = "'ヒラギノ角ゴ Pro W3','Hiragino Kaku Gothic Pro','メイリオ',Meiryo,'MS Pゴシック',sans-serif"; back.style.zIndex = '256'; /* IE6 */ if (typeof document.body.style.maxHeight == "undefined") {
  105.                     back.style.position = 'absolute'; }
  106.  
  107.                 document.body.appendChild(back); this.area = area; }
  108.         }
  109.  
  110.         , hide: function(element) {
  111.             if (element.childNodes.length > 0) {
  112.                 this.hide(element.firstChild);
  113.             }
  114.  
  115.             if (element.nodeType == 1) {
  116.                 element.style.display = 'none'; }
  117.  
  118.             if (element.nextSibling != null) {
  119.                 this.hide(element.nextSibling); }
  120.         }
  121.  
  122.         , appendImg: function(src, alt) {
  123.             var self = this;
  124.             var img = document.createElement('img'); img.src = src; img.alt = alt; img.style.border = self.postStyle.borderWidth + 'px solid ' + self.postStyle.color; img.style.cursor = 'pointer'; img.onmouseover = function() {
  125.                 var img = this; var offset = self.getElementOffset(this); var w = self.postStyle.borderWidth; self.post.style.left = offset[0] + 'px'; self.post.style.top = offset[1] + 'px'; self.post.style.width = img.width + w * 2 + 'px'; self.post.style.height = img.height + w * 2 + 'px'; self.post.style.display = 'block'; self.dialog.style.left = ((img.width + w * 2) / 2 - self.dialogStyle.width / 2) + 'px'; self.dialog.style.top = ((img.height + w * 2) / 2 - self.dialogStyle.height / 2) + 'px'; self.add_image.onclick = function() {
  126.                     var params = {
  127.                         src: img.src, url: (img.src==location.href?document.referrer:location.href), title: self.d.title, alt: img.alt, bookmarklet: 1, is_direct: img.src==location.href ? 1 : 0
  128.                     }
  129.  
  130.                     ; return self.postImg(img, params); }
  131.             }
  132.  
  133.             ; var div = document.createElement('div'); div.style.display = 'block'; div.style.margin = '20px'; div.style.textAlign = 'center'; div.appendChild(img); self.area.appendChild(div); }
  134.  
  135.         , delayAppendImg: function(src, alt) {
  136.             var self = this;
  137.             setTimeout(function() {
  138.                 self.appendImg(src, alt); }
  139.  
  140.             , self.t); self.t += 1000; }
  141.  
  142.         , scan: function() {
  143.             this.scanImg();
  144.             this.scanLink(); if(false) {
  145.                 /*******************/ for (var i in this.appendedUrls) {
  146.                     return; }
  147.  
  148.                 window.alert('登録できる画像がありません') /*******************/ }
  149.         }
  150.  
  151.         , scanImg: function() {
  152.             var self = this;
  153.             var imgs = this.d.getElementsByTagName('img'); var imgs_tmp = []; for (var i = 0; i < imgs.length; i++) {
  154.                 imgs_tmp.push(imgs[i]); }
  155.  
  156.             for(var i = 0; i < imgs_tmp.length; i++) {
  157.                 var img = imgs_tmp[i]; if (img.src.match(self.linkRegExp)) {
  158.                     var banSize = self.isThumbnail(img) ? self.banSize.thumbnail : self.banSize.regular;
  159.                     if(img.src.indexOf(self.host) !== -1 || (img.width < banSize && img.height < banSize)) {
  160.                         continue; }
  161.  
  162.                     if (self.isThumbnail(img)) {
  163.                         self.delayAppendImg(img.parentNode.href, img.alt); src = img.parentNode.href; }
  164.  
  165.                     else {
  166.                         self.appendImg(img.src, img.alt); src = img.src; }
  167.  
  168.                     self.appendedUrls[src] = 1; }
  169.             }
  170.         }
  171.  
  172.         , scanLink: function() {
  173.             var self = this;
  174.             var links = this.d.getElementsByTagName('a'); var links_tmp = []; for (var i = 0; i < links.length; i++) {
  175.                 links_tmp.push(links[i]); }
  176.  
  177.             for(var i = 0; i < links_tmp.length; i++) {
  178.                 var link = links_tmp[i]; if (link.href.match(self.linkRegExp) && !self.appendedUrls[link.href]) {
  179.                     self.delayAppendImg(link.href, (link.firstChild.nodeType == 3 ? link.firstChild.nodeValue : ''));
  180.                     self.appendedUrls[link.href] = 1; }
  181.             }
  182.         }
  183.  
  184.         , postImg: function(img, params) {
  185.             var self = this;
  186.             var url = []; url.push(self.endPoint); url.push('?'); for(var n in params) {
  187.                 url.push(encodeURIComponent(n)); url.push('='); url.push(encodeURIComponent(params[n])); url.push('&') }
  188.  
  189.             var e = self.d.createElement('script'); e.setAttribute('type','text/javascript'); e.setAttribute('src',url.join('')); e.setAttribute('charset','UTF-8'); self.d.body.appendChild(e); img.style.borderColor = self.postStyle.hoverColor; var offset = self.getElementOffset(img); var w = self.postStyle.borderWidth; var div = self.d.createElement('div'); div.id = img.src; div.style.position = 'absolute'; div.style.left = offset[0] + 'px'; div.style.top = offset[1] + 'px'; div.style.width = img.width + w * 2 + 'px'; div.style.height = img.height + w * 2 + 'px'; div.style.backgroundImage = 'url(' + self.imageUrl + '/posted_bg.gif)'; div.style.zIndex = '250'; self.d.body.appendChild(div); return false; }
  190.  
  191.         , getElementOffset: function(element) {
  192.             var valueT = 0;
  193.             var valueL = 0; while (element) {
  194.                 valueT += element.offsetTop||0; valueL += element.offsetLeft||0; element = element.offsetParent; if(element) {
  195.                     p = element.style.position; if (p=='relative' || p=='absolute') break }
  196.             }
  197.  
  198.             return [valueL, valueT] }
  199.  
  200.         , isThumbnail: function(img) {
  201.             var self = this;
  202.             return img.parentNode.tagName.toLowerCase() == 'a' && img.parentNode.href.match(self.linkRegExp); }
  203.     }
  204.  
  205.     ; var found = new Found(); /* found.scan(); */ /** import end **/ var scansrc = found.scan(); /* e.setAttribute('src','http://okinny.heypo.net/js/bookmarklet.js?'+d.getFullYear()+d.getMonth()+d.getDate()); */ e.setAttribute('src',scansrc); document.body.appendChild(e) }
  206.  
  207. )());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement