Created
October 3, 2011 04:10
-
-
Save hayajo/1258419 to your computer and use it in GitHub Desktop.
なんかやろうとしたけど...ダメだわ...こりゃ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function PB_RL() { | |
setTimeout('PB_RL.readlater();', 1); | |
}; | |
PB_RL.prototype = { | |
readlater : function() { | |
//PB_RL.u = encodeURIComponent(document.location.href); | |
//PB_RL.t = encodeURIComponent(document.title.replace(/^\s\s*/, '').replace(/\s\s*$/, '')); | |
//var url = 'https://pinboard.in/add?later=yes&noui=yes&jump=close&url='+PB_RL.u+'&title='+PB_RL.t; | |
//var xhr = new XMLHttpRequest(); | |
//xhr.onreadystatechange = function() { | |
//if (xhr.readyState == 4) { | |
//var msg = (xhr.status == 200) ? | |
//"<p>Add Pinboard read later !</p>" : | |
//"<p>Add Pinboard failed(" + xhr.status + ")"; | |
//msg += '<p><a style="text-decoration:underline;cursor:pointer;" onclick="PB_RL.hideMessage()">[Close]</a>'; | |
//PB_RL.displayMessage(msg); | |
//} | |
//} | |
//xhr.open('POST', url, true); | |
//xhr.send(null); | |
}, | |
displayMessage : function(m, scale) { | |
if (! this.msg) { | |
this.msg = document.createElement('div'); | |
} | |
var h = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; | |
this.msg.style.cssText = 'display:block;position:absolute;margin:0px;padding:0px;font-size:18px;font-family:Arial;text-align:center;font-size:14px;font-weight:bold;color:#000000;background: #FFFFFF;border:1px solid #333333;z-index:100000;padding:25px'; | |
document.body.appendChild(this.msg); | |
this.msg.style.fontSize = scale ? (h * 0.06) + 'px' : '18px'; | |
this.msg.innerHTML = m; | |
var y = window.pageYOffset ? window.pageYOffset : document.body.scrollLeft; | |
var x = window.pageXOffset ? window.pageXOffset : document.body.scrollTop; | |
var w = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth; | |
this.msg.style.top = ( y + ( h * 0.40 - this.msg.clientHeight / 2 ) ) + 'px'; | |
this.msg.style.left = ( x + ( w / 2 - this.msg.clientWidth / 2 ) ) + 'px'; | |
}, | |
hideMessage : function() { | |
this.msg.style.display = 'none'; | |
this.msg = false; | |
} | |
}; | |
var PB_RL = new PB_RL(); | |
void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
この方法だとどのみちHTML以外のリソース(画像など)で動かないので却下だわー。完全にムダだったわー。