coppermine-gallery.com/forum

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: Nibbler on May 18, 2005, 03:47:21 PM

Title: Greasemonkey Coppermine support script
Post by: Nibbler on May 18, 2005, 03:47:21 PM
This is a user script for the greasemonkey (http://greasemonkey.mozdev.org/) firefox extension. It adds the cpg version number and links to reset the theme+lang into the standard coppermine footer to save messing around with the source and adding things into the address bar.


// ==UserScript==
// @name          Coppermine Support script
// @description   Provides the version number of the Coppermine Gallery you are viewing, plus some misc support/debug tools.
// ==/UserScript==

(function() {
window.addEventListener("load", function(e) {
version = document.body.innerHTML.match(/<\!--Coppermine Photo Gallery (.*)-->/);

if (version){
divs = document.getElementsByTagName("div");
for (var i = divs.length-1 ; i >= 0; i--){
if (divs[i].className == 'footer') {
divs[i].innerHTML +=
'<p>Version: ' + version[1] + '</p>'
+ '<p>Theme & language: <a href="index.php?lang=xxx&theme=xxx">[Defaults]</a>'
+ '<a href="index.php?lang=english&theme=classic">[English + Classic]</a>';
return true;
}
}
}
  }, true);
})();


Suggestions welcome for further use of greasemonkey with coppermine.