Permalink
Browse files

Added support for per-script last update or version number, var is @v…

…ersionorlastupdate. Displays this in Help panel in compiled extension.
  • Loading branch information...
1 parent ab2a714 commit 20ec3710d0b436d8ce611b244c75423af44295fd @ginatrapani committed Aug 4, 2009
Showing with 23 additions and 15 deletions.
  1. +6 −3 compile.php
  2. +16 −11 templates/content--common--defaults.js.tpl
  3. +1 −1 templates/content--options.js.tpl
View
@@ -119,11 +119,12 @@
if (preg_match('/@enabledbydefault\b(.*)/', $line, $m)) {
$scripts[$script]['enabledbydefault']=trim($m[1]);
}
-
+ if (preg_match('/@versionorlastupdate\b(.*)/', $line, $m)) {
+ $scripts[$script]['versionorlastupdate']=trim($m[1]);
+ }
if (preg_match('/@description\b(.*)/', $line, $m)) {
$scripts[$script]['description']=trim($m[1]);
}
-
if (preg_match('/@include\b(.*)/', $line, $m)) {
$scripts[$script]['include'][]=trim($m[1]);
}
@@ -156,11 +157,13 @@
echo "ENABLED BY DEFAULT:".$scripts[$script]['enabledbydefault']."\n";
-
//set default tab
if (empty($scripts[$script]['tab'])) $scripts[$script]['tab']="General";
echo "LOCATED ON TAB:".$scripts[$script]['tab']."\n";
+ //set version or last update
+ if (empty($scripts[$script]['versionorlastupdate'])) $scripts[$script]['versionorlastupdate']="";
+ echo "LAST UPDATE:".$scripts[$script]['versionorlastupdate']."\n";
//convert includes/excludes
$scripts[$script]['include']=array_map('convertToRegExp', $scripts[$script]['include']);
@@ -10,7 +10,7 @@ var {$data.shortname}_tabs = {$smarty.ldelim}
}
-function {$data.shortname}_userScript(id, enabled, full_name, author, homepage, filename, description, enabled_by_default, tab, conflicts ) {$smarty.ldelim}
+function {$data.shortname}_userScript(id, enabled, full_name, author, homepage, filename, description, enabled_by_default, tab, conflicts, versionorlastupdate ) {$smarty.ldelim}
this.id = id;
this.enabled = enabled;
this.full_name = full_name;
@@ -21,10 +21,11 @@ function {$data.shortname}_userScript(id, enabled, full_name, author, homepage,
this.enabled_by_default = enabled_by_default;
this.tab = tab;
this.conflicts = conflicts;
+ this.versionorlastupdate = versionorlastupdate;
}
-function {$data.shortname}_makeNewUserScript(id, author, homepage, enabled_by_default, tab ) {$smarty.ldelim}
+function {$data.shortname}_makeNewUserScript(id, author, homepage, enabled_by_default, tab, versionorlastupdate ) {$smarty.ldelim}
//alert("making " + id);
return new {$data.shortname}_userScript(id,
{$data.shortname}_getOrElseSet(id, enabled_by_default),
@@ -36,10 +37,10 @@ function {$data.shortname}_makeNewUserScript(id, author, homepage, enabled_by_de
enabled_by_default,
tab,
null,
- null);
+ versionorlastupdate);
}
-function {$data.shortname}_makeNewUserScriptWithConflicts(id, author, homepage, enabled_by_default, tab, conflicts) {$smarty.ldelim}
+function {$data.shortname}_makeNewUserScriptWithConflicts(id, author, homepage, enabled_by_default, tab, conflicts, versionorlastupdate) {$smarty.ldelim}
return new {$data.shortname}_userScript(id,
{$data.shortname}_getOrElseSet(id, enabled_by_default),
{$data.shortname}_usLabels.GetStringFromName(id+"_title"),
@@ -50,10 +51,10 @@ function {$data.shortname}_makeNewUserScriptWithConflicts(id, author, homepage,
enabled_by_default,
tab,
conflicts,
- null);
+ versionorlastupdate);
}
-function {$data.shortname}_makeNewSkin(id, author, homepage ) {$smarty.ldelim}
+function {$data.shortname}_makeNewSkin(id, author, homepage, versionorlastupdate ) {$smarty.ldelim}
return new {$data.shortname}_userScript(id,
{$data.shortname}_getOrElseSet(id, false),
{$data.shortname}_usLabels.GetStringFromName(id+"_title"),
@@ -64,7 +65,7 @@ function {$data.shortname}_makeNewSkin(id, author, homepage ) {$smarty.ldelim}
false,
{$data.shortname}_tabs.SKINS,
null,
- null);
+ versionorlastupdate);
}
@@ -87,11 +88,13 @@ var {$data.shortname}_scripts = new Array(
'{$s.author}',
'{$s.homepage}',
{$s.enabledbydefault},
- {$data.shortname}_tabs.{$s.tab|upper}){if $smarty.foreach.sfe.last} {else},{/if}
+ {$data.shortname}_tabs.{$s.tab|upper},
+ '{$s.versionorlastupdate}'){if $smarty.foreach.sfe.last} {else},{/if}
{else}
new {$data.shortname}_makeNewSkin('{$s.id}',
'{$s.author}',
- '{$s.homepage}'){if $smarty.foreach.sfe.last} {else},{/if}
+ '{$s.homepage}',
+ '{$s.versionorlastupdate}'){if $smarty.foreach.sfe.last} {else},{/if}
{assign var='has_skins' value='yes'}
{/if}
{else}
@@ -100,7 +103,8 @@ var {$data.shortname}_scripts = new Array(
'{$s.homepage}',
{$s.enabledbydefault},
{$data.shortname}_tabs.{$s.tab|upper},
- new Array({$s.conflict}) ){if $smarty.foreach.sfe.last} {else},{/if}
+ new Array({$s.conflict}),
+ '{$s.versionorlastupdate}' ){if $smarty.foreach.sfe.last} {else},{/if}
{/if}
{/foreach}
@@ -114,7 +118,8 @@ var {$data.shortname}_scripts = new Array(
'',
'',
true,
- {$data.shortname}_tabs.SKINS)
+ {$data.shortname}_tabs.SKINS,
+ '')
{/if}
@@ -100,7 +100,7 @@ function {$data.shortname}_describescripts() {$smarty.ldelim}
var totalScripts = {$data.shortname}_scripts.length;
for (var i = 0; i < totalScripts; i++) {$smarty.ldelim}
if ( {$data.shortname}_scripts[i].homepage != '') {$smarty.ldelim}
- document.getElementById("script-listing").contentDocument.write('<li><b><a href="'+ {$data.shortname}_scripts[i].homepage+'" onclick="javascript:window.open(\''+ {$data.shortname}_scripts[i].homepage+'\');return false;">'+ {$data.shortname}_scripts[i].full_name +'</a></b><br />'+{$data.shortname}_scripts[i].description+'<br />'+{$data.shortname}_usLabels.GetStringFromName("script_by")+' '+{$data.shortname}_scripts[i].author+'</li>');
+ document.getElementById("script-listing").contentDocument.write('<li><b><a href="'+ {$data.shortname}_scripts[i].homepage+'" onclick="javascript:window.open(\''+ {$data.shortname}_scripts[i].homepage+'\');return false;">'+ {$data.shortname}_scripts[i].full_name +'</a></b><br />'+{$data.shortname}_scripts[i].description+' <i>'+ {$data.shortname}_scripts[i].versionorlastupdate +'</i><br />'+{$data.shortname}_usLabels.GetStringFromName("script_by")+' '+{$data.shortname}_scripts[i].author+'</li>');
}
}
document.getElementById("script-listing").contentDocument.write("</ul></body></html>");

0 comments on commit 20ec371

Please sign in to comment.