Advertisement
Guest User

Untitled

a guest
Apr 19th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: {
  2.   (function(win, dataAndEvents) {
  3.     /** @type {Document} */
  4.     var doc = win.document;
  5.     setTimeout(function() {
  6.       /**
  7.        * @param {MessageEvent} mojitProxy
  8.        * @return {undefined}
  9.        */
  10.       function init(mojitProxy) {
  11.         if (mojitProxy.data === "destroy_bookmarklet") {
  12.           /** @type {(HTMLElement|null)} */
  13.           var dialog = doc.getElementById(id);
  14.           if (dialog) {
  15.             doc.body.removeChild(dialog);
  16.             /** @type {null} */
  17.             dialog = null;
  18.           }
  19.         }
  20.       }
  21.       /** @type {string} */
  22.       var id = "DELI_bookmarklet_iframe";
  23.       /** @type {(HTMLElement|null)} */
  24.       var targetNode = doc.getElementById(id);
  25.       if (targetNode) {
  26.         return;
  27.       }
  28.       /** @type {string} */
  29.       var url = "https://delicious.com/save?source=bookmarklet&";
  30.       /** @type {Element} */
  31.       var frame = doc.createElement("iframe");
  32.       /** @type {string} */
  33.       frame.id = id;
  34.       /** @type {string} */
  35.       frame.src = url + "url=" + encodeURIComponent(win.location.href) + "&title=" + encodeURIComponent(doc.title) + "&note=" + encodeURIComponent("" + (win.getSelection ? win.getSelection() : doc.getSelection ? doc.getSelection() : doc.selection.createRange().text)) + "&v=1.1";
  36.       /** @type {string} */
  37.       frame.style.position = "fixed";
  38.       /** @type {string} */
  39.       frame.style.top = "0";
  40.       /** @type {string} */
  41.       frame.style.left = "0";
  42.       /** @type {string} */
  43.       frame.style.height = "100%";
  44.       /** @type {string} */
  45.       frame.style.width = "100%";
  46.       /** @type {string} */
  47.       frame.style.zIndex = "16777270";
  48.       /** @type {string} */
  49.       frame.style.border = "none";
  50.       /** @type {string} */
  51.       frame.style.visibility = "hidden";
  52.       /**
  53.        * @return {undefined}
  54.        */
  55.       frame.onload = function() {
  56.         /** @type {string} */
  57.         this.style.visibility = "visible";
  58.       };
  59.       doc.body.appendChild(frame);
  60.       /** @type {string} */
  61.       var add = win.addEventListener ? "addEventListener" : "attachEvent";
  62.       /** @type {string} */
  63.       var LOAD = add == "attachEvent" ? "onmessage" : "message";
  64.       win[add](LOAD, init, false);
  65.     }, 1);
  66.   })(window);
  67. }
  68. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement