-
Notifications
You must be signed in to change notification settings - Fork 43
/
script.js
4 lines (4 loc) · 9.73 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.7"},BROWSER_CHROME_SLUG="chrome",BROWSER_FIREFOX_SLUG="firefox",BROWSER_EDGE_SLUG="edge",BROWSER_SAFARI_SLUG="safari",DISSENTER_HOME_PAGE_URI="https://dissenter.com",BASE_URI="https://dissenter.com/discussion/begin-extension?url=",COMMENT_COUNT_URI="https://dissenter.com/notification/comment-count?url=",BACKGROUND_ACTION_OPEN_POPUP="open_popup",BACKGROUND_ACTION_GET_KEY="get_key",BACKGROUND_ACTION_SET_KEY="set_key",BACKGROUND_ACTION_SET_BADGE="set_badge",BACKGROUND_ACTION_TAB_UPDATED="tab_updated",COLOR_GAB_GREEN="#21cf7b",SEARCH_ENGINES=[{name:"DuckDuckGo",url:"https://duckduckgo.com/?q=",icon:"duckduckgo.svg"},{name:"Startpage",url:"https://www.startpage.com/do/search?q=",icon:"startpage.png"},{name:"Bing",url:"https://www.bing.com/search?q=",icon:"bing.svg"},{name:"Yahoo!",url:"https://search.yahoo.com/search?p=",icon:"yahoo.svg"},{name:"Google",url:"https://www.google.com/search?q=",icon:"google.svg"}],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",WEBSITE_COMMENT_BADGE_ENABLED="website_comment_badge_enabled",DISSENT_DISQUS_BUTTONS_ENABLED="dissent_disqus_buttons_enabled",WIKIPEDIA_BUTTONS_ENABLED="wikipedia_buttons_enabled",NT_DEFAULT_SEARCH_ENGINE="nt_default_search_engine",NT_TOP_SITES_ENABLED="nt_top_sites_enabled",NT_TOP_SITES_LIMIT="nt_top_sites_limit",NT_TOP_SITES_SIZE="nt_top_sites_size",NT_TOP_SITES_SHAPE="nt_top_sites_shape",NT_TOP_SITES_HIGHLIGHT="nt_top_sites_highlight",NT_TOP_SITES_SHOW_TITLE="nt_top_sites_show_title",NT_DATETIME_SHOW_DATE="nt_datetime_show_date",NT_DATETIME_SHOW_TIME="nt_datetime_show_time",NT_COLORS_SEARCH="nt_colors_search",NT_COLORS_TEXT="nt_colors_text",NT_BACKGROUND_RANDOM="nt_background_random",NT_BACKGROUND_SOLID_COLOR="nt_background_solid_color",NT_BACKGROUND_IMAGE="nt_background_image",NT_BACKGROUND_RANDOM_GRADIENT="nt_background_random_gradient",NT_DISSENTER_ENABLED="nt_dissenter_enabled",NT_DISSENTER_DEFAULT_TAB="nt_dissenter_default_tab",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,STORAGE_DEFAULT_PARAMS[WEBSITE_COMMENT_BADGE_ENABLED]=!1,STORAGE_DEFAULT_PARAMS[DISSENT_DISQUS_BUTTONS_ENABLED]=!1,STORAGE_DEFAULT_PARAMS[WIKIPEDIA_BUTTONS_ENABLED]=!0,STORAGE_DEFAULT_PARAMS[NT_DEFAULT_SEARCH_ENGINE]=SEARCH_ENGINES[0],STORAGE_DEFAULT_PARAMS[NT_TOP_SITES_ENABLED]=!1,STORAGE_DEFAULT_PARAMS[NT_TOP_SITES_LIMIT]=10,STORAGE_DEFAULT_PARAMS[NT_TOP_SITES_SIZE]="md",STORAGE_DEFAULT_PARAMS[NT_TOP_SITES_SHAPE]="circle",STORAGE_DEFAULT_PARAMS[NT_TOP_SITES_HIGHLIGHT]="light",STORAGE_DEFAULT_PARAMS[NT_TOP_SITES_SHOW_TITLE]=!0,STORAGE_DEFAULT_PARAMS[NT_DATETIME_SHOW_DATE]=!0,STORAGE_DEFAULT_PARAMS[NT_DATETIME_SHOW_TIME]=!0,STORAGE_DEFAULT_PARAMS[NT_COLORS_SEARCH]="white",STORAGE_DEFAULT_PARAMS[NT_COLORS_TEXT]="white",STORAGE_DEFAULT_PARAMS[NT_BACKGROUND_RANDOM]=!1,STORAGE_DEFAULT_PARAMS[NT_BACKGROUND_SOLID_COLOR]="",STORAGE_DEFAULT_PARAMS[NT_BACKGROUND_IMAGE]="",STORAGE_DEFAULT_PARAMS[NT_BACKGROUND_RANDOM_GRADIENT]=!0,STORAGE_DEFAULT_PARAMS[NT_DISSENTER_ENABLED]=!0,STORAGE_DEFAULT_PARAMS[NT_DISSENTER_DEFAULT_TAB]="home";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"))}function getDissenterDLogoAsSVG(t,e,r,n){var _=document.createElementNS("http://www.w3.org/2000/svg","svg");_.style.setProperty("height",t,"important"),_.style.setProperty("width",e,"important"),_.setAttribute("version","1.1"),_.setAttribute("xmlns","http://www.w3.org/2000/svg"),_.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),_.setAttribute("viewBox","0 0 500 500");var i=document.createElementNS("http://www.w3.org/2000/svg","g");i.style.setProperty("transform","translate(17, 37)","important");var o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d","M244.885937,0 L193.657763,0 L65.5018905,0 L45.5665325,0 C20.4992438,0 0,20.5016933 0,45.5466667 L0,381.453333 C0,406.504 20.4992438,427 45.5665325,427 L65.5018905,427 L193.657763,427 L244.885937,427 C389.348933,427 467,326.3134 467,213.5 C467,100.6866 393.563837,0 244.885937,0"),o.setAttribute("fill",r);var A=document.createElementNS("http://www.w3.org/2000/svg","path");A.setAttribute("d","M309.275885,155 L121.729792,155 C115.246045,155 110,149.623395 110,143.002906 C110,136.376605 115.246045,131 121.729792,131 L309.275885,131 C315.759633,131 321,136.376605 321,143.002906 C321,149.623395 315.759633,155 309.275885,155"),A.setAttribute("fill",n);var s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d","M309.275885,225 L121.729792,225 C115.246045,225 110,219.623395 110,213.002906 C110,206.376605 115.246045,201 121.729792,201 L309.275885,201 C315.759633,201 321,206.376605 321,213.002906 C321,219.623395 315.759633,225 309.275885,225"),s.setAttribute("fill",n);var E=document.createElementNS("http://www.w3.org/2000/svg","path");return E.setAttribute("d","M121.78718,296 C115.271711,296 110,290.623395 110,284.002906 C110,277.376605 115.271711,272 121.78718,272 L247.218525,272 C253.733994,272 259,277.376605 259,284.002906 C259,290.623395 253.733994,296 247.218525,296 L121.78718,296 Z"),E.setAttribute("fill",n),i.appendChild(o),i.appendChild(A),i.appendChild(s),i.appendChild(E),_.appendChild(i),_}function addManyClasses(t,e){if(!isArray(e))return!1;for(var r=0,n=e.length;r<n;r++)t.classList.add(e[r])}function removeManyClasses(t,e){if(!isArray(e))return!1;for(var r=0,n=e.length;r<n;r++)t.classList.remove(e[r])}var GDTwitterV2=function(){var o=[];function A(){var t=document.querySelectorAll('div[aria-label="Share Tweet"]');if(setTimeout(A,2e3),!t||0==t.length)return!1;for(var e=0;e<t.length;e++){var r=t[e],n=a(r);if(n&&!(-1<o.indexOf(n))){o.push(n);var _=r.parentElement.parentElement.parentElement,i=s();_.appendChild(i),i.onclick=E.bind(null,n)}}}function s(){var e=document.createElement("a");e.setAttribute("title","Dissent"),e.style.setProperty("display","inline-block","important"),e.style.setProperty("height","35px","important"),e.style.setProperty("width","35px","important"),e.style.setProperty("position","absolute","important"),e.style.setProperty("right","-6px","important"),e.style.setProperty("bottom","-8px","important"),e.style.setProperty("border-radius","50%","important");var t=getDissenterDLogoAsSVG("18px","18px","#657786","#fff");return t.style.setProperty("display","block","important"),t.style.setProperty("margin","9px","important"),e.onmouseover=function(){var t=this.querySelectorAll("path")[0];if(!t)return!1;t.setAttribute("fill","#20cf7b"),e.style.setProperty("background-color","rgba(32,207,123,.1)","important")},e.onmouseout=function(){var t=this.querySelectorAll("path")[0];if(!t)return!1;t.setAttribute("fill","#657786"),e.style.removeProperty("background-color")},e.appendChild(t),e}function E(t){var e=window.innerHeight;chrome.runtime.sendMessage({action:BACKGROUND_ACTION_OPEN_POPUP,url:t,height:e})}function a(t){if(!t)return null;var e=t.parentElement.parentElement.parentElement.querySelectorAll('a[href*="/status/"]')[0];if(!e)return null;var r=e.getAttribute("href");return r&&isString(r)?"https://www.twitter.com"+r:null}this.init=function(){A()}};ready(function(){chrome.runtime.sendMessage({action:BACKGROUND_ACTION_GET_KEY,key:TWITTER_BUTTONS_ENABLED},function(t){if(!t)return!1;setTimeout(function(){(new GDTwitterV2).init()},150)})});var GDTwitter=function(){var o=[];function A(){var t=document.querySelectorAll("div.tweet.js-actionable-tweet");if(!t||0==t.length)return!1;for(var e=0;e<t.length;e++){var r=t[e],n=a(r);if(n&&!(-1<o.indexOf(n))){o.push(n);var _=r.querySelector("div.ProfileTweet-actionList.js-actions"),i=s();_.appendChild(i),i.onclick=E.bind(null,n)}}setTimeout(A,2e3)}function s(){var t=document.createElement("a");t.setAttribute("title","Dissent"),t.style.setProperty("display","inline-block","important"),t.style.setProperty("position","absolute","important"),t.style.setProperty("height","18px","important"),t.style.setProperty("width","20px","important"),t.style.setProperty("vertical-align","bottom","important"),t.style.setProperty("right","12px","important"),t.style.setProperty("bottom","8px","important");var e=getDissenterDLogoAsSVG("18px","18px","#637481","#fff");return t.onmouseover=function(){var t=this.querySelectorAll("path")[0];if(!t)return!1;t.setAttribute("fill","#20cf7b")},t.onmouseout=function(){var t=this.querySelectorAll("path")[0];if(!t)return!1;t.setAttribute("fill","#637481")},t.appendChild(e),t}function E(t){var e=window.innerHeight;chrome.runtime.sendMessage({action:BACKGROUND_ACTION_OPEN_POPUP,url:t,height:e})}function a(t){if(!t)return null;var e=t.getAttribute("data-permalink-path");return e&&isString(e)?"https://www.twitter.com"+e:null}this.init=function(){A()}};ready(function(){chrome.runtime.sendMessage({action:BACKGROUND_ACTION_GET_KEY,key:TWITTER_BUTTONS_ENABLED},function(t){if(!t)return!1;setTimeout(function(){(new GDTwitter).init()},150)})});