Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript: {
- (function(win, dataAndEvents) {
- /** @type {Document} */
- var doc = win.document;
- setTimeout(function() {
- /**
- * @param {MessageEvent} mojitProxy
- * @return {undefined}
- */
- function init(mojitProxy) {
- if (mojitProxy.data === "destroy_bookmarklet") {
- /** @type {(HTMLElement|null)} */
- var dialog = doc.getElementById(id);
- if (dialog) {
- doc.body.removeChild(dialog);
- /** @type {null} */
- dialog = null;
- }
- }
- }
- /** @type {string} */
- var id = "DELI_bookmarklet_iframe";
- /** @type {(HTMLElement|null)} */
- var targetNode = doc.getElementById(id);
- if (targetNode) {
- return;
- }
- /** @type {string} */
- var url = "https://delicious.com/save?source=bookmarklet&";
- /** @type {Element} */
- var frame = doc.createElement("iframe");
- /** @type {string} */
- frame.id = id;
- /** @type {string} */
- frame.src = url + "url=" + encodeURIComponent(win.location.href) + "&title=" + encodeURIComponent(doc.title) + "¬e=" + encodeURIComponent("" + (win.getSelection ? win.getSelection() : doc.getSelection ? doc.getSelection() : doc.selection.createRange().text)) + "&v=1.1";
- /** @type {string} */
- frame.style.position = "fixed";
- /** @type {string} */
- frame.style.top = "0";
- /** @type {string} */
- frame.style.left = "0";
- /** @type {string} */
- frame.style.height = "100%";
- /** @type {string} */
- frame.style.width = "100%";
- /** @type {string} */
- frame.style.zIndex = "16777270";
- /** @type {string} */
- frame.style.border = "none";
- /** @type {string} */
- frame.style.visibility = "hidden";
- /**
- * @return {undefined}
- */
- frame.onload = function() {
- /** @type {string} */
- this.style.visibility = "visible";
- };
- doc.body.appendChild(frame);
- /** @type {string} */
- var add = win.addEventListener ? "addEventListener" : "attachEvent";
- /** @type {string} */
- var LOAD = add == "attachEvent" ? "onmessage" : "message";
- win[add](LOAD, init, false);
- }, 1);
- })(window);
- }
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement