Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:void( (function() {
- var d= new Date(); var e=document.createElement('script'); e.setAttribute('type','text/javascript'); e.setAttribute('charset','utf-8'); /** import start**/ (function() {
- var w = window; var d = w.document; w.setEventHandler=(function() {
- if (w.addEventListener) {
- return function(obj,evt,handler) {
- obj.addEventListener(evt,handler,false)}
- ; }
- else if (w.attachEvent) {
- return function(obj,evt,handler) {
- obj.attachEvent('on'+evt,handler)}
- ; }
- else {
- return function(obj,evt,handler) {
- var org=obj['on'+evt];obj['on'+evt]=function() {
- if(typeof org=='function')org();handler()}
- }
- ; }
- }
- )(); if(true) {
- /*******************/ w.setMouseHandler=function(obj, evt, handler) {
- var mouseHandler=function(curEvent,e) {
- if (!e) e=w.event; if (!e) return; var prop=obj._MouseProp_; var curStatus=prop.status; if (curStatus==curEvent) return; if (curStatus=='out') {
- /* outer to inner */ var fncArrayOver=prop.fncArrayOver; for (var ci=0,len=fncArrayOver.length; ci<len; ci++) {
- fncArrayOver[ci].apply(obj,[e]); }
- }
- else {
- /* inner to outer */ var chkNode=e.toElement||e.relatedTarget; while (chkNode) {
- if (chkNode==obj) return; chkNode=chkNode.parentNode; }
- var fncArrayOut=prop.fncArrayOut; for (var ci=0,len=fncArrayOut.length; ci<len; ci++) {
- fncArrayOut[ci].apply(obj,[e]); }
- }
- prop.status=curEvent; }
- ; var prop=obj._MouseProp_; if (!prop) {
- prop=obj._MouseProp_= {
- status: 'out',fncArrayOver:[],fncArrayOut:[]
- }
- ; w.setEventHandler(obj,'mouseover',function(e) {
- mouseHandler('over',e)}
- ); w.setEventHandler(obj,'mouseout',function(e) {
- mouseHandler('out',e)}
- ); }
- if (evt=='mouseover') {
- prop.fncArrayOver[prop.fncArrayOver.length]=handler; }
- else if (evt=='mouseout') {
- prop.fncArrayOut[prop.fncArrayOut.length]=handler; }
- else {
- w.setEventHandler(obj,evt,handler); }
- }
- ; /*******************/ }
- }
- )(); function Found() {
- this.initialize.apply(this, arguments); }
- Found.prototype = {
- host: 'okinny.heypo.net', endPointPath: '/image/post', imageUrlDir: '/images', linkRegExp: /\.(jpe?g|png|gif)/i, banSize: {
- regular: 300, thumbnail: 150
- }
- , postStyle: {
- id: '__found_overlay', borderWidth: 5, color: '#006699', hoverColor: '#000'
- }
- , dialogStyle: {
- width: 250, height: 50, color: '#fff', anchorColor: '#fff', backgroundColor: '#000'
- }
- , t: 0, appendedUrls: {
- }
- , initialize: function() {
- this.endPoint = 'http://' + this.host + this.endPointPath;
- this.imageUrl = 'http://' + this.host + this.imageUrlDir; this.w = window; if(0 < document.getElementsByTagName('frame').length) {
- this.d=window[0].document; }
- else {
- this.d=document; }
- this.hide(document.body); this.post = this.d.getElementById(this.postStyle.id); if (!this.post) {
- 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) {
- /*******************/ 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() {
- this.style.display = 'none'; }
- ); /*******************/ }
- 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") {
- back.style.position = 'absolute'; }
- document.body.appendChild(back); this.area = area; }
- }
- , hide: function(element) {
- if (element.childNodes.length > 0) {
- this.hide(element.firstChild);
- }
- if (element.nodeType == 1) {
- element.style.display = 'none'; }
- if (element.nextSibling != null) {
- this.hide(element.nextSibling); }
- }
- , appendImg: function(src, alt) {
- var self = this;
- 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() {
- 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() {
- var params = {
- 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
- }
- ; return self.postImg(img, params); }
- }
- ; var div = document.createElement('div'); div.style.display = 'block'; div.style.margin = '20px'; div.style.textAlign = 'center'; div.appendChild(img); self.area.appendChild(div); }
- , delayAppendImg: function(src, alt) {
- var self = this;
- setTimeout(function() {
- self.appendImg(src, alt); }
- , self.t); self.t += 1000; }
- , scan: function() {
- this.scanImg();
- this.scanLink(); if(false) {
- /*******************/ for (var i in this.appendedUrls) {
- return; }
- window.alert('登録できる画像がありません') /*******************/ }
- }
- , scanImg: function() {
- var self = this;
- var imgs = this.d.getElementsByTagName('img'); var imgs_tmp = []; for (var i = 0; i < imgs.length; i++) {
- imgs_tmp.push(imgs[i]); }
- for(var i = 0; i < imgs_tmp.length; i++) {
- var img = imgs_tmp[i]; if (img.src.match(self.linkRegExp)) {
- var banSize = self.isThumbnail(img) ? self.banSize.thumbnail : self.banSize.regular;
- if(img.src.indexOf(self.host) !== -1 || (img.width < banSize && img.height < banSize)) {
- continue; }
- if (self.isThumbnail(img)) {
- self.delayAppendImg(img.parentNode.href, img.alt); src = img.parentNode.href; }
- else {
- self.appendImg(img.src, img.alt); src = img.src; }
- self.appendedUrls[src] = 1; }
- }
- }
- , scanLink: function() {
- var self = this;
- var links = this.d.getElementsByTagName('a'); var links_tmp = []; for (var i = 0; i < links.length; i++) {
- links_tmp.push(links[i]); }
- for(var i = 0; i < links_tmp.length; i++) {
- var link = links_tmp[i]; if (link.href.match(self.linkRegExp) && !self.appendedUrls[link.href]) {
- self.delayAppendImg(link.href, (link.firstChild.nodeType == 3 ? link.firstChild.nodeValue : ''));
- self.appendedUrls[link.href] = 1; }
- }
- }
- , postImg: function(img, params) {
- var self = this;
- var url = []; url.push(self.endPoint); url.push('?'); for(var n in params) {
- url.push(encodeURIComponent(n)); url.push('='); url.push(encodeURIComponent(params[n])); url.push('&') }
- 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; }
- , getElementOffset: function(element) {
- var valueT = 0;
- var valueL = 0; while (element) {
- valueT += element.offsetTop||0; valueL += element.offsetLeft||0; element = element.offsetParent; if(element) {
- p = element.style.position; if (p=='relative' || p=='absolute') break }
- }
- return [valueL, valueT] }
- , isThumbnail: function(img) {
- var self = this;
- return img.parentNode.tagName.toLowerCase() == 'a' && img.parentNode.href.match(self.linkRegExp); }
- }
- ; 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) }
- )());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement