Skip to content

Commit

Permalink
First commit, very alpha version
Browse files Browse the repository at this point in the history
  • Loading branch information
ginatrapani committed Apr 12, 2009
0 parents commit e07bf06
Show file tree
Hide file tree
Showing 99 changed files with 15,441 additions and 0 deletions.
Empty file added .gitignore
Empty file.
80 changes: 80 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
h1. Greasemonkey Multi-Script Compiler
by Gina Trapani (http://ginatrapani.org)
Based heavily on code from Anthony Lieuallen located at:
http://arantius.com/misc/greasemonkey/script-compiler

h2. Warning
This alpha code is a delicate flower that hasn't been tested nearly as thoroughly as it needs to be. There isn't much documentation, either. Use at your own risk.

h2. System Requirements

* Bash
* PHP
* Smarty:http://smarty.net


h2. Quick User Guide

Things have to be set up exactly right for the compiler to succeed. Good luck. (More detailed documentation is to come.)

h3. Configure Your User Scripts

* In the project's _input directory, create a folder named after your extension without spaces, all lowercase, ie:
<pre>$ mkdir mygreatextension</pre>

* Copy the <pre>config.inc.php</pre> file into your new directory. In it, fill in your extension's name, description, GUID, and all other required bits of information. For example:

<pre>'name'=>"Better Gmail 2",

'description'=>"Enhances Gmail with a compilation of useful features written by Greasemonkey user script developers. All scripts copyright their original authors. Click on the script homepage in the Help tab for more information.",

'creator'=>"Gina Trapani (All user scripts copyright their original authors)",

'guid'=>'123456789',

'homepage'=>"http://ginatrapani.org/workshop/firefox/bettergmail2/",

'minVersion'=>'1.5',

'maxVersion'=>'3.1b3',

'updateURL'=>'https://secure.ginatrapani.org/workshop/firefox/update.rdf',

'helpMsg'=>'Refresh Gmail to apply your changes.',
</pre>

* Make a <pre>user_scripts</pre> subdirectory, and copy all the user scripts you want to include in your extension into it.

* For each user script, add an @author, @homepage, @enabledbydefault, @tab parameters, all of which will show up in your extension's options dialog.


h3. Run the Compiler

To run the compiler, make the <pre>compile.sh</pre> file executable, and call it, ie:

<pre>$ chmod +x compile.sh
$ ./compile.sh bettergmail2 0.8 dist</pre>

Here's more on the command usage:

<pre>Usage: compile.sh extension_short_name version_number [package_mode]
Example:
compile.sh bettergmail2 1.8 dist
Short name:
Extension "short name" is also the name of the folder where its files live,
all lower case, without spaces (ie, bettergmail2)
Version number:
Version number (ie, 1.0 or 2.3)
Package mode: dist | test | amo
dist for installable xpi (most common)
test for deflated version for testing
amo for installable xpi without an updateURL (for uploading to Mozilla Add-ons)
</pre>








26 changes: 26 additions & 0 deletions _input/betteramazon/config.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

$GMSC = array(

'name'=>"Better Amazon",

'description'=>"Enhances Amazon.com with a compilation of user scripts and styles. All scripts copyright their original authors. Click on the script homepage in the Help tab for more information.",

'creator'=>"Gina Trapani (All user scripts copyright their original authors)",

'guid'=>'betteramazon@ginatrapani.org',

'homepage'=>"http://ginatrapani.org/workshop/firefox/betteramazon/",

'minVersion'=>'1.5',

'maxVersion'=>'3.0.*',

'updateURL'=>'https://secure.ginatrapani.org/workshop/firefox/update.rdf',

'helpMsg'=>'Refresh the current web page to apply your changes.',

);


?>
Binary file added _input/betteramazon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions _input/betteramazon/todo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
TODO


*Make Shorten Product Links work with co.uk site

*Make Shorten Product Links use shorter associate URL format:
http://lifehacker.com/397946/better-amazon-firefox-extension-upgrades-amazoncom#c6542238

*Add always use https connection?

* Add comment box expander?
http://userscripts.org/scripts/show/4110
27 changes: 27 additions & 0 deletions _input/betteramazon/user_scripts/cleaneramazonbookpages.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ==UserScript==
// @name Cleaner Amazon Book Pages
// @namespace http://userstyles.org
// @description Hides all the unnecessary bells and whistles on a book page on Amazon.
// @author timepiece
// @homepage http://userstyles.org/styles/4328
// @include htt*amazon.*/*



// ==/UserScript==
(function() {
var css = "@namespace url(http://www.w3.org/1999/xhtml); .h1, .otherEditions, .fionaPublishTable, .tiny, .simsWrapper, .EBBdivider, .bucketDivider, .moreBuyingChoices, .flashPlayer, .qpTableTop, .qpTableLeft, .qpTableCenter, .qpImage, .qpTableRight, .qpTableBottom, #nonmemberStripe, #goKindleStaticPopDiv, #ftMessage, #specialOffersDiv, #primaryUsedAndNew, #secondaryUsedAndNew, #view-dpv-rich-media, #quickPromoBucketContent, #AutoBuyXGetY, #ManualBuyXGetY, #productDescription { display: none ! important; }";
if (typeof GM_addStyle != "undefined") {
GM_addStyle(css);
} else if (typeof addStyle != "undefined") {
addStyle(css);
} else {
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
heads[0].appendChild(node);
}
}
})();
114 changes: 114 additions & 0 deletions _input/betteramazon/user_scripts/collapsibleamazon.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// ==UserScript==
// @name Collapsible Amazon
// @author Ben Hollis
// @namespace http://brh.numbera.com/software/greasemonkeyscripts
// @description Collapse any section of the Amazon.com web site by clicking on the orange section header.
// @include http://*.amazon.*
// @version 3.0

// @homepage http://brh.numbera.com/software/greasemonkeyscripts/
// @enabledbydefault true
// ==/UserScript==

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };

function findContent(bucket, header) {
if(header == null)
return null;

var current = header;
var contents = [];

while(current != bucket) {
while(current.nextSibling) {
current = current.nextSibling;

if(current.style)
contents.push(current);
}

current = current.parentNode;

if(current.className == "amabot_endcap")
return null;
}

return contents;
}

function findHeader(bucket) {
var header = document.evaluate('.//b[contains(@class, "h1")] | .//h2 | .//strong[contains(@class, "h1")] | .//h1[contains(@class, "h1")]', bucket, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

if(header.snapshotLength > 0) {
return header.snapshotItem(0);
}
else {
return null;
}
}

function headerClickHandler(header, contents, key) {
return function () {
var opened = GM_getValue(key, true);

if(opened == true) {
opened = false;
closeSection(contents);
header.className = header.className.replace("brhgmopened", "brhgmclosed");
}
else {
opened = true;
openSection(contents);
header.className = header.className.replace("brhgmclosed", "brhgmopened");
}

GM_setValue(key, opened);
};
}

function setupHandlers() {
GM_addStyle(".brhgmopened { cursor:pointer; }\n" +
".brhgmclosed { cursor:pointer; }\n" +
".brhgmopened:before { content:\"-\"; color: black; font-weight: bold; border: 1px solid black; padding:0 3px; font-size:10px; margin-right: 4px;}\n" +
".brhgmclosed:before { content:\"+\"; color: black; font-weight: bold; border: 1px solid black; padding:0 3px; font-size:10px; margin-right: 4px;}");

var allBuckets = document.evaluate('//div[contains(@class, "bucket")] | //td[contains(@class, "bucket")] | //div[contains(@class, "acc")] | //div[contains(@class, "graybox")] | //div[contains(@class, "cmPage")]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

for(var i = 0; i < allBuckets.snapshotLength; i++) {
var bucket = allBuckets.snapshotItem(i);

var header = findHeader(bucket);
var contents = findContent(bucket, header);

if(header && contents) {
var key = header.innerHTML.trim();

var opened = GM_getValue(key, true);

header.addEventListener("click", headerClickHandler(header, contents, key), false);

if(opened == false) {
closeSection(contents);
header.className += " brhgmclosed";
}
else {
header.className += " brhgmopened";
}
}
}

}

function closeSection(contents) {
for each(var content in contents) {
content.style.display = "none";
}
}

function openSection(contents) {
for each(var content in contents) {
content.style.display = "";
}
}

setupHandlers();
Loading

0 comments on commit e07bf06

Please sign in to comment.