share.js 8.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. browser.storage.sync.get().then(function(settings) {
  2. if(settings.domain) {
  3. if(settings.keeptweet) {
  4. var style = document.createElement("style");
  5. var link = document.createElement("a");
  6. var icon = document.createElement("i");
  7. style.appendChild(document.createTextNode(".label {margin-left:0 !important} .btn {padding-right:6px !important}"));
  8. document.body.appendChild(style);
  9. link.className = "btn";
  10. link.style.marginLeft = "5px";
  11. link.href = document.getElementById("b").href.replace(/twitter.com\/intent\/tweet/g,settings.domain+"/intent/toot");
  12. icon.style.backgroundImage = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGVklEQVRYhZ1XbWxT1xl+49iQBPIByZLcS2ApCKnq2h+dCuVDUZi0jYkVUItAFaVSVaXlR38koAYC2MR2CA1flUYgJCbxtYtotW6Ij1I6TWoRVatCWVJhCLFNNMsxU7aJpSwjQ8l9z3n2417HTmI7yV7plX3vPfc+z33e57z3HKJM4XRayOm0jB+XlORTZVU1ra2po43Ok/TaifP02onztNF5ktbW1FFlVTWVlOSnvX9WsXVr9vj/ypdX0avN7VR7PUKOXpAzBGoMghr7zAwa5xy9oNrrEXq1uZ0qX16V8lmzAlcrn6Xt7RfIFQa5+0H2ACyOAGxNIc5piXDesRjnHYtxTkuEbU0htjgCIHvAGOsKg7a3XyC18tlZkEDW+MCVO2roQGCYXGFQQ4+c4w7qRa1DsqxzFIomofoA1W+mD1A0ibLOURS1Dsk57pBODT2SXGHQgcAwrdxRkyCBrOnffP2+I9QcBe3rgbXxnl7cNgzFZ4CWawLlXka5V0d5l5le3TinCYOMT6K4bRjWxns67esBNUdB6+uPZFZi3TqrAV5/hA4PgBpu6blHB2S5JqD4pAliAmVMY5zikyjXBHKPDkhquKXT4ViCRBxrypu/uO1tao6C9twem/fhoFT9SHrodMCpiDBUPzDvw0FJe26PUXMU9OK2tycq4XRaiJBFpYuXkePOCDV0c+7RARP8/wGeSkT1w1Sim8lxZ4RKFy8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WiOLmWG/8A1X0/ZvsgiuxVb7yTenE6w0XpIo0xr51x1eyEySaU0jBb8seq7vOHknbf1K0fxGD97cHjqRelkxen6+vTLssrfAJzzzCctwRYSDzV5XiNk+PryBOsOd3HtLsb1sPRBHjmvUGmjUlIL2odkuWdoyg6K/HLK1NlfzSi42LvY7nZ38+0p0eSPQyr484TWr1j5wzAUyiRZmtmbQpxXkuEd156yPXXHvJbf4jyurNhLjkUAO0NgOwPYHGHkf2m5xIt/NlzqWs+UxJE6TenDX1G7guCDoRA9l7Y3r8RtW1p8dBPV6xJ+axZRbrt+eqaOstG50nb1hPnbduOf5K9+dBpS/XO3dZl1b+gBQsK096fIv4HRI8A8hJEH2oAAAAASUVORK5CYII=)";
  13. icon.style.backgroundSize = "cover";
  14. link.appendChild(icon);
  15. document.getElementById("l").innerText = "";
  16. document.getElementsByClassName("btn-o")[0].appendChild(link);
  17. }
  18. else {
  19. document.getElementById("b").href = document.getElementById("b").href.replace(/twitter.com\/intent\/tweet/g,settings.domain+"/intent/toot");
  20. document.getElementById("l").innerText = "Toot";
  21. document.getElementsByTagName("i")[0].style.backgroundImage = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGVklEQVRYhZ1XbWxT1xl+49iQBPIByZLcS2ApCKnq2h+dCuVDUZi0jYkVUItAFaVSVaXlR38koAYC2MR2CA1flUYgJCbxtYtotW6Ij1I6TWoRVatCWVJhCLFNNMsxU7aJpSwjQ8l9z3n2417HTmI7yV7plX3vPfc+z33e57z3HKJM4XRayOm0jB+XlORTZVU1ra2po43Ok/TaifP02onztNF5ktbW1FFlVTWVlOSnvX9WsXVr9vj/ypdX0avN7VR7PUKOXpAzBGoMghr7zAwa5xy9oNrrEXq1uZ0qX16V8lmzAlcrn6Xt7RfIFQa5+0H2ACyOAGxNIc5piXDesRjnHYtxTkuEbU0htjgCIHvAGOsKg7a3XyC18tlZkEDW+MCVO2roQGCYXGFQQ4+c4w7qRa1Dsqxz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AwC4vhco9DCKu8QkE2aYhilbqpdR2sV45iNG6MdEvTNF/PqfBySWfzQKy4G7MutgfBrOoBElZ4WPMfcMw31bTHjD6WLUHKj98FhSfQDZddfNRjTLVqxqjEIP4+bf5XgTmkmwKcMr58I62fth2ZxoxTP+GMXlX+JPMuAMCLDZmG7GRkB7e0S2Owzb0hUrJi5GZvA5VrzGTFh+jvHoqUlgGnAJQBcSQgIrTvUx2cPIfqPjagJ7FguSZAMOjkyvgAQwZkpfe+1vknb9ha3OwH+pYulyIspK7BlmuSQr7WLcHzJAMjWiOLmWG/8A1X0/ZvsgiuxVb7yTenE6w0XpIo0xr51x1eyEySaU0jBb8seq7vOHknbf1K0fxGD97cHjqRelkxen6+vTLssrfAJzzzCctwRYSDzV5XiNk+PryBOsOd3HtLsb1sPRBHjmvUGmjUlIL2odkuWdoyg6K/HLK1NlfzSi42LvY7nZ38+0p0eSPQyr484TWr1j5wzAUyiRZmtmbQpxXkuEd156yPXXHvJbf4jyurNhLjkUAO0NgOwPYHGHkf2m5xIt/NlzqWs+UxJE6TenDX1G7guCDoRA9l7Y3r8RtW1p8dBPV6xJ+axZRbrt+eqaOstG50nb1hPnbduOf5K9+dBpS/XO3dZl1b+gBQsK096fIv4HRI8A8hJEH2oAAAAASUVORK5CYII=)";
  22. document.getElementsByTagName("i")[0].style.backgroundSize = "cover";
  23. document.getElementById("b").onclick = function() {};
  24. }
  25. }
  26. else {
  27. document.getElementById("b").href = browser.runtime.getURL("settings.html");
  28. document.getElementById("l").innerText = "Config";
  29. document.getElementsByTagName("i")[0].style.backgroundImage = "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGVklEQVRYhZ1XbWxT1xl+49iQBPIByZLcS2ApCKnq2h+dCuVDUZi0jYkVUItAFaVSVaXlR38koAYC2MR2CA1flUYgJCbxtYtotW6Ij1I6TWoRVatCWVJhCLFNNMsxU7aJpSwjQ8l9z3n2417HTmI7yV7plX3vPfc+z33e57z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1yniLacvxjauxD3rEYx+d+mZfxuzsJBF0Aj0eBwRGg918SA/8x5c9AQpjl+PVlgfw4iS6jJ+QdizE19oG2HP94CoHSTh1L/IbJ1l0UWHOBsfJTxgufMJadM2uqMa5E5DhQOhUA4LtBiQKPQUDxpiIwqQTlXh1lXUb9CzyMIo/h5uJOY9opmnG82Md4+MRUIkMpAKClW4BOMVRNR4V/cgnSmDA+A+KpaAk3L/ExbG0Mf9BA0KfxAwC4vhco9DCKu8QkE2aYhilbqpdR2sV45iNG6MdEvTNF/PqfBySWfzQKy4G7MutgfBrOoBElZ4WPMfcMw31bTHjD6WLUHKj98FhSfQDZddfNRjTLVqxqjEIP4+bf5XgTmkmwKcMr58I62fth2ZxoxTP+GMXlX+JPMuAMCLDZmG7GRkB7e0S2Owzb0hUrJi5GZvA5VrzGTFh+jvHoqUlgGnAJQBcSQgIrTvUx2cPIfqPjagJ7FguSZAMOjkyvgAQwZkpfe+1vknb9ha3OwH+pYulyIspK7BlmuSQr7WLcHzJAMjWiOLmWG/8A1X0/ZvsgiuxVb7yTenE6w0XpIo0xr51x1eyEySaU0jBb8seq7vOHknbf1K0fxGD97cHjqRelkxen6+vTLssrfAJzzzCctwRYSDzV5XiNk+PryBOsOd3HtLsb1sPRBHjmvUGmjUlIL2odkuWdoyg6K/HLK1NlfzSi42LvY7nZ38+0p0eSPQyr484TWr1j5wzAUyiRZmtmbQpxXkuEd156yPXXHvJbf4jyurNhLjkUAO0NgOwPYHGHkf2m5xIt/NlzqWs+UxJE6TenDX1G7guCDoRA9l7Y3r8RtW1p8dBPV6xJ+axZRbrt+eqaOstG50nb1hPnbduOf5K9+dBpS/XO3dZl1b+gBQsK096fIv4HRI8A8hJEH2oAAAAASUVORK5CYII=)";
  30. document.getElementsByTagName("i")[0].style.backgroundSize = "cover";
  31. document.getElementById("b").onclick = function() {};
  32. }
  33. });