Skip to content

Commit

Permalink
Cleanup (replace tabs with spaces)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ede123 committed Apr 29, 2020
1 parent f5da3d8 commit 699b327
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 116 deletions.
62 changes: 31 additions & 31 deletions AMO_Editors.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,43 @@ var href = window.location.href;
/** add styles at "document-start" **/
// avoid line breaks in file viewer whenever possible by using full width of window
if (href.indexOf("/files/") != -1) {
GM_addStyle(".file-viewer .section { width: unset; max-width: 95%;}" +
".file-viewer .syntaxhighlighter .line {max-width: unset;}");
GM_addStyle(".file-viewer .section { width: unset; max-width: 95%;}" +
".file-viewer .syntaxhighlighter .line {max-width: unset;}");
}

/** modify DOM on DOMContentLoaded **/
addEventListener('DOMContentLoaded', function() {
// add a "Review" button to add-on listings
if (href.indexOf("/addon/") != -1) {
var widgets = document.getElementsByClassName("widgets")[0];
// add a "Review" button to add-on listings
if (href.indexOf("/addon/") != -1) {
var widgets = document.getElementsByClassName("widgets")[0];

var p = document.createElement("p");
var button = document.createElement("a");
button.classList.add("button", "developer", "prominent");
button.href = href.replace(/\/addon\//, "/editors/review/");
var button_span = document.createElement("span");
button_span.textContent = "Review";
var p = document.createElement("p");
var button = document.createElement("a");
button.classList.add("button", "developer", "prominent");
button.href = href.replace(/\/addon\//, "/editors/review/");
var button_span = document.createElement("span");
button_span.textContent = "Review";

button.appendChild(button_span);
p.appendChild(button);
widgets.parentNode.insertBefore(p, widgets.nextSibling);
}
// pre-fill "Tested on:" fields with current user agent data
else if (href.indexOf("/editors/review/") != -1) {
var inputOS = document.getElementById("id_operating_systems");
var inputApp = document.getElementById("id_applications");
button.appendChild(button_span);
p.appendChild(button);
widgets.parentNode.insertBefore(p, widgets.nextSibling);
}
// pre-fill "Tested on:" fields with current user agent data
else if (href.indexOf("/editors/review/") != -1) {
var inputOS = document.getElementById("id_operating_systems");
var inputApp = document.getElementById("id_applications");

var ua = detect.parse(navigator.userAgent);
inputOS.value = ua.os.name;
inputApp.value = ua.browser.family + " " + ua.browser.major + "." + ua.browser.minor;
var ua = detect.parse(navigator.userAgent);
inputOS.value = ua.os.name;
inputApp.value = ua.browser.family + " " + ua.browser.major + "." + ua.browser.minor;

// add a button to clear the fields again (e.g. on trivial updates which where not tested)
var button = document.createElement("a");
button.href = "javascript:void(0);";
button.textContent = "⌫";
button.classList.add("button");
button.style = "float: right; padding: 2px 5px; border-radius: 5px;";
button.addEventListener("click", function() {inputOS.value = ""; inputApp.value = "";});
inputApp.parentNode.appendChild(button);
}
// add a button to clear the fields again (e.g. on trivial updates which where not tested)
var button = document.createElement("a");
button.href = "javascript:void(0);";
button.textContent = "⌫";
button.classList.add("button");
button.style = "float: right; padding: 2px 5px; border-radius: 5px;";
button.addEventListener("click", function() {inputOS.value = ""; inputApp.value = "";});
inputApp.parentNode.appendChild(button);
}
}, false);
60 changes: 30 additions & 30 deletions GitHub_Latest.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,53 @@

// redirect link to automatically sort "your stars" by "recently active"
document.body.addEventListener('mousedown', function(e){
var targ = e.target || e.srcElement;
if ( targ && targ.href && targ.href.match(/tab=stars$/) ) {
targ.href = targ.href.replace(/tab=stars$/, "tab=stars&sort=updated");
}
var targ = e.target || e.srcElement;
if ( targ && targ.href && targ.href.match(/tab=stars$/) ) {
targ.href = targ.href.replace(/tab=stars$/, "tab=stars&sort=updated");
}
});

// add a button to "latest issues"
function addLatestButton() {
// do not add button again if already present
if (document.getElementById("latest-button")) {
return;
}
if (document.getElementById("latest-button")) {
return;
}

var reponav = document.getElementsByClassName("reponav");
if (reponav && (reponav = reponav[0])) {
var reponav = document.getElementsByClassName("reponav");
if (reponav && (reponav = reponav[0])) {
var reponav_list = reponav.firstElementChild;
var list_item_issues_copy = reponav_list.children[1].cloneNode(true);

var button = list_item_issues_copy.firstElementChild;
button.id = "latest-button"
button.href += "?sort=updated";
button.style.float = "right";
var button = list_item_issues_copy.firstElementChild;
button.id = "latest-button"
button.href += "?sort=updated";
button.style.float = "right";

// unselect
button.classList.remove("selected");
button.removeAttribute("data-selected-links");
// unselect
button.classList.remove("selected");
button.removeAttribute("data-selected-links");

// adjust icon
button.firstElementChild.firstElementChild.setAttribute("class","octicon octicon-flame");
button.firstElementChild.firstElementChild.firstChild.setAttribute("d","M5.05 0.31c0.81 2.17 0.41 3.38-0.52 4.31-0.98 1.05-2.55 1.83-3.63 3.36-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-0.3-6.61-0.61 2.03 0.53 3.33 1.94 2.86 1.39-0.47 2.3 0.53 2.27 1.67-0.02 0.78-0.31 1.44-1.13 1.81 3.42-0.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52 0.13-2.03 1.13-1.89 2.75 0.09 1.08-1.02 1.8-1.86 1.33-0.67-0.41-0.66-1.19-0.06-1.78 1.25-1.23 1.75-4.09-1.88-6.22l-0.02-0.02z");
// adjust icon
button.firstElementChild.firstElementChild.setAttribute("class","octicon octicon-flame");
button.firstElementChild.firstElementChild.firstChild.setAttribute("d","M5.05 0.31c0.81 2.17 0.41 3.38-0.52 4.31-0.98 1.05-2.55 1.83-3.63 3.36-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-0.3-6.61-0.61 2.03 0.53 3.33 1.94 2.86 1.39-0.47 2.3 0.53 2.27 1.67-0.02 0.78-0.31 1.44-1.13 1.81 3.42-0.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52 0.13-2.03 1.13-1.89 2.75 0.09 1.08-1.02 1.8-1.86 1.33-0.67-0.41-0.66-1.19-0.06-1.78 1.25-1.23 1.75-4.09-1.88-6.22l-0.02-0.02z");

// remove counter
var counter = button.getElementsByClassName('counter')[0] || button.getElementsByClassName('Counter')[0];
// remove counter
var counter = button.getElementsByClassName('counter')[0] || button.getElementsByClassName('Counter')[0];
if (counter) {
button.removeChild(counter);
}

var items = button.querySelectorAll('[itemprop]');
for (var i = 0; i < items.length; i++) {
// adjust name
if (items[i].getAttribute("itemprop") == "name") {
items[i].textContent = "Latest issues"
}
}
var items = button.querySelectorAll('[itemprop]');
for (var i = 0; i < items.length; i++) {
// adjust name
if (items[i].getAttribute("itemprop") == "name") {
items[i].textContent = "Latest issues"
}
}

reponav_list.appendChild(list_item_issues_copy);
}
reponav_list.appendChild(list_item_issues_copy);
}
}

addLatestButton();
Expand Down
20 changes: 10 additions & 10 deletions Google_Cleaner.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
// ==/UserScript==

GM_addStyle(
// hide some unnecessary stuff
'.pdp-psy,' // cookie warning
+ '#taw,' // privacy notifications
+ '#appbar' // number of results
+ ' {display:none !important;}'
// hide some unnecessary stuff
'.pdp-psy,' // cookie warning
+ '#taw,' // privacy notifications
+ '#appbar' // number of results
+ ' {display:none !important;}'

// reduce height of menu header
+ '#hdtbSum { height:35px !important; line-height:31px !important;}' // header
+ '.hdtb-msel { height:31px !important;}' // selected header item
+ '#hdtbMenus { top:unset !important;}' // search options menu
+ '#hdtb-more-mn { top:unset !important;}' // more menu
// reduce height of menu header
+ '#hdtbSum { height:35px !important; line-height:31px !important;}' // header
+ '.hdtb-msel { height:31px !important;}' // selected header item
+ '#hdtbMenus { top:unset !important;}' // search options menu
+ '#hdtb-more-mn { top:unset !important;}' // more menu
);
22 changes: 11 additions & 11 deletions OpenSubtitles_Direct_Downloads.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ GM_addStyle('#loginBoxSubs{display:none}');


function modifyButton() {
// check for download button on page
var downloadButton = document.getElementById('bt-dwl') || document.getElementById('bt-dwl-bt');
if(!downloadButton) return;
// check for download button on page
var downloadButton = document.getElementById('bt-dwl') || document.getElementById('bt-dwl-bt');
if(!downloadButton) return;

// extract direct link from "dowSub()" function
var re1 = /product_download_url=([^'"]+)'/;
var downloadURL = document.body.innerHTML.match(re1)[1];
// extract direct link from "dowSub()" function
var re1 = /product_download_url=([^'"]+)'/;
var downloadURL = document.body.innerHTML.match(re1)[1];
downloadURL = decodeURIComponent(downloadURL);

var re2 = /(.+)\/(vrf-[a-z0-9]+)$/;
var match = downloadURL.match(re2);
downloadURL = match[1].replace('download', 'download/' + match[2]);

// create direct link avoiding advert page for "Open Subtitles MKV Player"
downloadButton.href = downloadURL;
downloadButton.removeAttribute("onclick");
downloadButton.href = downloadURL;
downloadButton.removeAttribute("onclick");

// remove event listeners from the download button (by cloning and replacing it)
// to prevent any unwanted behavior
downloadButton.parentNode.replaceChild(downloadButton.cloneNode(true), downloadButton);
// remove event listeners from the download button (by cloning and replacing it)
// to prevent any unwanted behavior
downloadButton.parentNode.replaceChild(downloadButton.cloneNode(true), downloadButton);
}


Expand Down
68 changes: 34 additions & 34 deletions Rotten_Tomatoes_Link_On_IMDb.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ var IMDbID = IMDbID_RegEx.exec(window.location.href)[1];

// function to add the Rotten Tomatoes button
var addButton = function(link) {
// icon
var RT_icon = document.createElement('img');
// RT_icon.src = "http://www.rottentomatoes.com/favicon.ico";
// RT_icon.src = "https://staticv2.rottentomatoes.com/static/images/icons/favicon.ico";
// RT_icon.src = "https://rottentomatoes.com/static/images/icons/favicon.ico";
RT_icon.src = "https://staticv2-4.rottentomatoes.com/static/images/icons/favicon.ico";
RT_icon.width = RT_icon.height = 16;
RT_icon.style.verticalAlign = "bottom";
// icon
var RT_icon = document.createElement('img');
// RT_icon.src = "http://www.rottentomatoes.com/favicon.ico";
// RT_icon.src = "https://staticv2.rottentomatoes.com/static/images/icons/favicon.ico";
// RT_icon.src = "https://rottentomatoes.com/static/images/icons/favicon.ico";
RT_icon.src = "https://staticv2-4.rottentomatoes.com/static/images/icons/favicon.ico";
RT_icon.width = RT_icon.height = 16;
RT_icon.style.verticalAlign = "bottom";

// link
var RT_link = document.createElement('a');
RT_link.target = "_blank";
RT_link.href = link;
// link
var RT_link = document.createElement('a');
RT_link.target = "_blank";
RT_link.href = link;

RT_link.appendChild(RT_icon);
RT_link.appendChild(RT_icon);

// spacer
var spacer = document.createElement('span');
spacer.classList.add("ghost");
spacer.textContent = "|";
// spacer
var spacer = document.createElement('span');
spacer.classList.add("ghost");
spacer.textContent = "|";

//add link to IMDb movie page
var subtext = document.getElementsByClassName("subtext")[0];
if (subtext) {
subtext.appendChild(spacer);
subtext.appendChild(RT_link);
}
//add link to IMDb movie page
var subtext = document.getElementsByClassName("subtext")[0];
if (subtext) {
subtext.appendChild(spacer);
subtext.appendChild(RT_link);
}
};


Expand All @@ -58,15 +58,15 @@ if (GM.xmlHttpRequest === undefined) { GM.xmlHttpRequest = GM_xmlhttpRequest; }

// get Rotten Tomatoes movie alias from Rotten Tomatoes API
GM.xmlHttpRequest({
method: "GET",
url: "http://www.omdbapi.com/?apikey=6be019fc&tomatoes=true&i=" + IMDbID,
onload: function(response) {
var json = JSON.parse(response.responseText);
if (json && json.tomatoURL && json.tomatoURL != "N/A") {
addButton(json.tomatoURL);
}
else if (json && json.Error) {
console.log("Error: " + json.Error);
}
}
method: "GET",
url: "http://www.omdbapi.com/?apikey=6be019fc&tomatoes=true&i=" + IMDbID,
onload: function(response) {
var json = JSON.parse(response.responseText);
if (json && json.tomatoURL && json.tomatoURL != "N/A") {
addButton(json.tomatoURL);
}
else if (json && json.Error) {
console.log("Error: " + json.Error);
}
}
});

0 comments on commit 699b327

Please sign in to comment.