Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ========= youtube-layout.js =========
- let url = "";
- window.addEventListener("scroll", function(e) {
- if(window.location.href !== url) {
- url = window.location.href;
- // Test the root element of the extension, #reddit_comments, to see if extension has already been appended
- if (document.getElementById("comments") != null){
- document.getElementById("comments").remove();
- }
- if (document.getElementById("dissenter-parent-outer") != null){
- document.getElementById("dissenter-parent-outer").remove();
- }
- var parent = document.createElement("div");
- parent.id = "dissenter-parent-outer"
- var parentIn = document.createElement("div");
- parentIn.id = "dissenter-parent-inner"
- var iframe = document.createElement("iframe");
- iframe.src = "https://dissenter.com/discussion/begin-extension?url=" + url;
- iframe.id = "dissenter"
- iframe.class = "style-scope ytd-watch-flexy"
- parentIn.appendChild(iframe)
- parent.appendChild(parentIn)
- document.getElementById("primary-inner").appendChild(parent);
- }
- });
- ========= youtube-layout.css =========
- #dissenter {
- display: block;
- width: 100%;
- height: 100%;
- border: none;
- margin-top: -150px;
- }
- #dissenter-parent-inner {
- clip: rect(10px, 3000px, 3000px, 0px);
- position: absolute;
- width: 100%;
- height: 100%;
- }
- #dissenter-parent-outer {
- position: relative;
- width: 100%;
- height: 50%;
- }
- #primary-inner {
- height: 100%;
- }
- ========= manifest.json =========
- {
- "background.persistent": false,
- "incognito": "not_allowed",
- "offline_enabled": false,
- "version_name": "0.1.0",
- "manifest_version": 2,
- "name": "Dissenter Extension",
- "short_name": "Dissenter",
- "description": "Dissenter is the comment section of the Internet.",
- "homepage_url": "https://dissenter.com",
- "version": "0.1.0",
- "icons": {
- "16": "assets/images/logo/icon-16.png",
- "48": "assets/images/logo/icon-48.png",
- "128": "assets/images/logo/icon-128.png"
- },
- "permissions": [
- "activeTab",
- "https://*.dissenter.com/*"
- ],
- "browser_action": {
- "default_icon": "assets/images/logo/icon-128.png",
- "default_popup": "popup/popup.html"
- },
- "commands": {
- "_execute_browser_action": {
- "suggested_key": {
- "default": "Alt+Shift+D",
- "mac": "Alt+Shift+D"
- }
- }
- },
- "content_scripts": [{
- "matches": ["https://www.youtube.com/watch?v=*"],
- "js": ["content/youtube-layout.js"],
- "css": ["content/youtube-layout.css"],
- "run_at": "document_end"
- }],
- "background": {
- "scripts": [
- "background/background.js"
- ]
- },
- "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self' https://*.dissenter.com/*"
- }
Advertisement
Add Comment
Please, Sign In to add comment