-
-
Save erikvold/1113872 to your computer and use it in GitHub Desktop.
User scripts for AMO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name View Add-on Compatibility Reports | |
// @namespace http://userscripts.org/scripts/show/61398 | |
// @version 0.1 | |
// @description Adds a link to add-on compatibility reports to addons.mozilla.org. | |
// @include https://addons.mozilla.org/* | |
// @include https://preview.addons.mozilla.org/* | |
// @author http://userscripts.org/users/fcp | |
// @license This program is in the public domain. | |
// ==/UserScript== | |
void function(){ | |
function encodeAsFormValue(s) | |
{ | |
return s.replace(/[\x00-\x1F!\"#\$%&\'\(\)\*\+,\/\:;<=>\?@\[\\\]\^`\{\|\}]/g, function(str){ | |
var code = str.charCodeAt(0); | |
if (code <= 0x0F) | |
return '%0' + code.toString(16).toUpperCase(); | |
else | |
return '%' + code.toString(16).toUpperCase(); | |
}).replace(/ /g, '+'); | |
} | |
var found = location.href.match(/^https:\/\/[^\/]+\/([^\/?#]+)\/([^\/?#]+)\/addon\/.*\/?$/); | |
if (!found) | |
return; | |
var lang = found[1]; | |
var application = found[2]; | |
let button = document.querySelector("#addon-summary .install-button a"); | |
if (!button) return; | |
var addonid = button.href.match(/\d+/).toString(); | |
var parent = button.parentNode.parentNode.parentNode | |
var div = parent.appendChild(document.createElement("div")); | |
var a = div.appendChild(document.createElement('a')); | |
a.href = '/' + lang + '/' + application + '/compatibility/reporter?guid=' + encodeAsFormValue(addonid); | |
a.className = "button"; | |
a.appendChild(document.createTextNode('View compatibility reports')); | |
}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name AMO Forum Document Title | |
// @namespace loucypher@mozillaca.com | |
// @include https://forums.mozilla.org/addons/*.php* | |
// @exclude https://forums.mozilla.org/addons/index.php* | |
// ==/UserScript== | |
var title = document.title.replace(/\s\u2022.*\-\s/, ""); | |
title = title.replace("Mozilla Add-ons Forum", ""); | |
document.title = title + " \u2022 Mozilla Add-ons Forum"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name AMO Forum: Open posted links in new tab | |
// @namespace http://mozilla.status.net/loucypher | |
// @include https://forums.mozilla.org/addons/viewtopic.php*t=* | |
// @include https://forums.mozilla.org/addons/viewtopic.php*p=* | |
// ==/UserScript== | |
let postlinks = document.querySelectorAll("#page-body .postlink"); | |
if (!postlinks.length) return; | |
for (var i = 0; i < postlinks.length; i++) { | |
postlinks[i].target = "_blank"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name AMO Plus Like | |
// @namespace http://mozilla.status.net/loucypher | |
// @description Add Google+1 Button and Facebook Like to AMO | |
// @version 0.0 | |
// @author LouCypher | |
// @license Public domain | |
// @include https://addons.mozilla.org/*/*/addon/*/* | |
// ==/UserScript== | |
let addon = document.body.querySelector(".section > #addon"); | |
if (!addon) return; // not an add-on page | |
let gScript = addScript("https://apis.google.com/js/plusone.js"); | |
document.querySelector("head").appendChild(gScript); | |
let fScript = addScript("https://connect.facebook.net/en_US/all.js#xfbml=1"); | |
document.querySelector("head").appendChild(fScript); | |
let sum = addon.querySelector("#addon-summary-wrapper"); | |
let widgets = sum.parentNode.querySelector(".widgets"); | |
widgets.parentNode.insertBefore(document.createElement("g:plusone"), widgets); | |
widgets.style.marginTop = "-1em"; | |
let d = widgets.parentNode.insertBefore(document.createElement("div"), widgets); | |
d.style.margin = "-1em 0 2em"; | |
let fbLike = d.appendChild(document.createElement("fb:like")); | |
fbLike.setAttribute("send", "true"); | |
fbLike.setAttribute("show_faces", "false"); | |
fbLike.setAttribute("layout", "button_count"); | |
let editPopup = document.body.querySelector("#edit-popup"); | |
if (editPopup) { | |
editPopup.style.top = "644px"; | |
} | |
function addScript(aSrc) { | |
let script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.src = aSrc; | |
return script; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name AMO: Manage My Add-on | |
// @namespace http://mozilla.status.net/loucypher | |
// @description Manage your add-on directly from add-on page without having to visit dev-hub page first | |
// @version 0.2 | |
// @copyright 2011 by LouCypher | |
// @license MPL 1.1 http://www.mozilla.org/MPL/ | |
// @include https://addons.mozilla.org/*/*/addon/*/* | |
// ==/UserScript== | |
/* | |
Changelog: | |
- 2011-06-30: | |
v0.2: | |
+ Added: localization supports (default en-US) | |
+ Added: Bahasa Indonesia (id) locale | |
x Changed: don't hide menu when you click the link in menu | |
* Fixed: wrong position in "rtl" direction (Arabic, Hebrew) | |
v0.1: Initial released | |
*/ | |
/* ***** BEGIN LICENSE BLOCK ***** | |
* Version: MPL 1.1 | |
* | |
* The contents of this file are subject to the Mozilla Public License | |
* Version 1.1 (the "License"); you may not use this file except in | |
* compliance with the License. You may obtain a copy of the License at | |
* http://www.mozilla.org/MPL/ | |
* | |
* Software distributed under the License is distributed on an "AS IS" basis, | |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
* for the specific language governing rights and limitations under the | |
* License. | |
* | |
* The Original Manage My Add-ons user script. | |
* | |
* The Initial Developer of the Original Code is LouCypher. | |
* Portions created by the Initial Developer are Copyright (C) 2011 | |
* the Initial Developer. All Rights Reserved. | |
* | |
* Contributor(s) | |
* - LouCypher <loucypher@mozillaca.com> | |
* | |
* ***** END LICENSE BLOCK ***** */ | |
let profile = document.querySelector("#aux-nav > .account ul > li > a"); | |
if (!profile) return; // you're not logged in to AMO | |
//GM_log("You have LOGGED IN."); | |
let addon = document.body.querySelector(".section > #addon"); | |
if (!addon) return; // not an add-on page | |
//GM_log("This is an ADD-ON page."); | |
let author = document.querySelector("hgroup > h4.author > a"); | |
if (author.href != profile.href) return; // not your extension | |
//GM_log("This is YOUR add-on."); | |
let sum = addon.querySelector("#addon-summary-wrapper"); | |
let app = location.pathname.split("/")[2]; | |
let lang = location.pathname.split("/")[1]; | |
let text; // l10n | |
switch (lang) { | |
case "id": // Bahasa Indonesia | |
text = { | |
menu: "Kelola pengaya ini", | |
edit: "Edit keterangan pengaya", | |
ownership: "Kelola kepemilikan dan lisensi", | |
profile: "Kelola profil pengembang", | |
payments: "Kelola pembayaran", | |
versions: "Kelola status dan riwayat" | |
} | |
break; | |
default: // en-US | |
text = { | |
menu: "Manage this add-on", | |
edit: "Edit Add-on Listing", | |
ownership: "Manage Authors & License", | |
profile: "Manage Developer Profile", | |
payments: "Manage Payments", | |
versions: "Manage Status & Versions" | |
}; | |
} | |
let widgets = sum.parentNode.querySelector(".widgets"); | |
let link = widgets.appendChild(document.createElement("a")); | |
link.id = "edit-widget"; | |
link.className = "edit widget"; | |
link.href = "#"; | |
link.textContent = text.menu; | |
link.addEventListener("click", function(e) { | |
e.preventDefault(); | |
let popup = document.querySelector("#edit-popup"); | |
popup.style.display = (popup.style.display == "none") ? "block" : "none"; | |
}, false); | |
let leftRight = (document.documentElement.dir == "rtl") | |
? "right: 26.1px; left: inherit; " | |
: "left: 26.1px; right: inherit; "; | |
let block = "display: block;"; | |
let baseURL = location.pathname.replace(app, "developers").toString(); | |
let menu = new XML(<div xmlns="http://www.w3.org/1999/xhtml" | |
id="edit-popup" class="popup" | |
style={"width: 200px; display: none; " + | |
"top: 572px; " + leftRight + | |
"bottom: inherit;"}> | |
<div> | |
<ul id="dont-hide"> | |
<li> | |
<a href={baseURL + "edit"} style={block}> | |
{text.edit} | |
</a> | |
</li> | |
<li> | |
<a href={baseURL + "ownership"} style={block}> | |
{text.ownership} | |
</a> | |
</li> | |
<li> | |
<a href={baseURL + "profile"} style={block}> | |
{text.profile} | |
</a> | |
</li> | |
<li> | |
<a href={baseURL + "payments"} style={block}> | |
{text.payments} | |
</a> | |
</li> | |
<li> | |
<a href={baseURL + "versions"} style={block}> | |
{text.versions} | |
</a> | |
</li> | |
</ul> | |
</div> | |
</div>); | |
let div = (new DOMParser) | |
.parseFromString(menu.toXMLString(), "application/xml") | |
.documentElement; | |
document.body.appendChild(div); | |
window.addEventListener("click", function(e) { | |
if ((e.target.id == "edit-widget") || | |
(e.target.parentNode.parentNode.id == "dont-hide")) return; | |
let popup = document.querySelector("#edit-popup"); | |
popup.style.display = "none"; | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment