-
Notifications
You must be signed in to change notification settings - Fork 43
/
script.js
4 lines (4 loc) · 3.24 KB
/
script.js
1
2
3
4
/* Automatically generated file. Do not edit directly.
Copyright (C) 2019 Gab AI, Inc.
All Rights Reserved */
var BROWSER_CONFIG={name:"Google Chrome",slug:"chrome",version:"0.1.4"},BROWSER_CHROME_SLUG="chrome",BROWSER_FIREFOX_SLUG="firefox",BROWSER_EDGE_SLUG="edge",BROWSER_SAFARI_SLUG="safari",BASE_URI="https://dissenter.com/discussion/begin-extension?url=",BACKGROUND_ACTION_OPEN_POPUP="open_popup",BACKGROUND_ACTION_GET_KEY="get_key",BACKGROUND_ACTION_SET_KEY="set_key",COLOR_GAB_GREEN="#21cf7b",STORAGE_BASE="gab_dissenter_extension_data",TWITTER_BUTTONS_ENABLED="twitter_buttons_enabled",REDDIT_BUTTONS_ENABLED="reddit_buttons_enabled",YOUTUBE_BUTTONS_ENABLED="youtube_buttons_enabled",WINDOW_SIDEBAR_UNAVAILABLE_ENABLED="window_sidebar_unavailable_enabled",STORAGE_DEFAULT_PARAMS={};STORAGE_DEFAULT_PARAMS[TWITTER_BUTTONS_ENABLED]=!0,STORAGE_DEFAULT_PARAMS[REDDIT_BUTTONS_ENABLED]=!0,STORAGE_DEFAULT_PARAMS[YOUTUBE_BUTTONS_ENABLED]=!0,STORAGE_DEFAULT_PARAMS[WINDOW_SIDEBAR_UNAVAILABLE_ENABLED]=!0;var STORAGE_KEY_ALL="all",isObject=function(t){return!isArray(t)&&!isDate(t)&&(null!==t&&"object"==typeof t)},isString=function(t){return"string"==typeof t||t instanceof String},isDate=function(t){return!isString(t)&&!isArray(t)&&null!=t&&null!=t&&(t&&"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(t))},isArray=function(t){return Array.isArray(t)};function ready(t){var e=document;"loading"==e.readyState?e.addEventListener("DOMContentLoaded",t):t()}function getQueryStringValue(t){return decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]"+encodeURIComponent(t).replace(/[\.\+\*]/g,"\\$&")+"(?:\\=([^&]*))?)?.*$","i"),"$1"))}var GDReddit=function(){var a=[];function s(){var t=document.querySelectorAll('a[data-click-id="comments"][data-test-id="comments-page-link-num-comments"]');if(!t)return!1;for(var e=0;e<t.length;e++){var n=t[e],r=l(n);if(r&&!(-1<a.indexOf(r))){a.push(r);var o=n.parentElement;o.style.setProperty("width","100%","important");var i=_();o.appendChild(i),i.onclick=E.bind(null,r)}}setTimeout(s,2e3)}function _(){var t=document.createElement("a");return t.textContent="Dissent This",t.style.setProperty("display","block","important"),t.style.setProperty("position","absolute","important"),t.style.setProperty("height","20px","important"),t.style.setProperty("width","80px","important"),t.style.setProperty("background-color",COLOR_GAB_GREEN,"important"),t.style.setProperty("border-radius","2px","important"),t.style.setProperty("right","6px","important"),t.style.setProperty("bottom","6px","important"),t.style.setProperty("left","auto","important"),t.style.setProperty("top","auto","important"),t.style.setProperty("color","#fff","important"),t.style.setProperty("font-size","12px","important"),t.style.setProperty("text-align","center","important"),t.style.setProperty("line-height","20px","important"),t}function E(t){var e=window.innerHeight;chrome.runtime.sendMessage({action:BACKGROUND_ACTION_OPEN_POPUP,url:t,height:e})}function l(t){if(!t)return null;var e=t.getAttribute("href");return e&&isString(e)?"https://www.reddit.com"+e:null}this.init=function(){s()}};ready(function(){chrome.runtime.sendMessage({action:BACKGROUND_ACTION_GET_KEY,key:REDDIT_BUTTONS_ENABLED},function(t){if(!t)return!1;setTimeout(function(){(new GDReddit).init()},150)})});