New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
You are here: Foswiki>Tasks Web>Item8531 (17 Mar 2010, PaulHarvey)Edit Attach

Item8531: Cleanup plugins to use BuildContrib's features

Priority: Normal
Current State: Being Worked On
Released In:
Target Release: n/a
Applies To: Extension
Component: AnyWikiDrawPlugin, FirebugLitePlugin, UploadPlugin
Reported By: OlivierRaginel
Waiting For:
Last Change By: PaulHarvey
BuildContrib supports minifying and compressing on-the-fly. Cleanup plugins to not save these versions in SVN.

This way it is easier to maintain plugins, and duplicate files (source, compressed and minified) versions are no longer kept, but part of the release process.

Plugins to do:
  • .uncompressed.(js|css) file exists and so does the .(js|css):
You may remove these with:
for i in $(find */ -name '*.js' -o -name '*.css');do [ -f ${i%.js}.uncompressed.js ] && rm -v $i;[ -f ${i%.css}.uncompressed.css ] && rm -v $i;done,

  • .gz exists and so does the uncompressed version:
AnyWikiDrawPlugin 1 (.jar.gz)
FirebugLitePlugin 3
UploadPlugin 2
You may remove these with:
for i in $(find */ -name '*.gz');do [ -f ${i%.gz} ] && rm -v $i;done

  • *_src.(js|css) exists and so does the .(js|css) version
BehaviourContrib 2
EditRowPlugin 2
EditTablePlugin 2
InlineEditPlugin 26
JSCalendarContrib 1
TinyMCEUsabilityUpgradePlugin 1
TwistyContrib 2
You may remove these with:
for i in $(find */ -name '*_src.*');do [ -f ${i/_src/} ] && rm -v ${i/_src/};done

Assigning it to MichaelDaum as many are his plugins, I don't want to mess with his plugins without his knowledge, and he told me on IRC he would do it the day BuildContrib provides this functionnality.

-- OlivierRaginel - 15 Feb 2010

You need to also look for _src.js, which is what TinyMCEPlugin uses.

  • Moxiecode ships TinyMCE with minified .js
    • But we overwrite them with our own minified files.
    • Their minifier is better (produces smaller files) than the CPAN lib we use.
  • TinyMCE does not ship with .gz files when it really, really should... oversight on my part perhaps.
    • Problem is we ship many unnecessary .js files in tinymce/jscripts/tiny_mce/classes, most users will never touch those files unless they re-build the main tiny_mce_src.js file with ant.

-- PaulHarvey - 16 Feb 2010

i processed ImageGalleryPlugin and removed it from the lists.

-- WillNorris - 16 Feb 2010

Paul, that's funny that their minifier is better, can you diff them (or I will later on today) to see what we're missing. Maybe our minifiercan be tuned to be more powerful.

Updated the list with the _src files, and fixed some typos.

-- OlivierRaginel - 16 Feb 2010

Processed EditChapterPlugin, ImagePlugin, JQueryPlugin, MediaWikiTablePlugin, MetaCommentPlugin, NatEditPlugin, NatSkin and RedDotPlugin. UploadPlugin still to go - currently under development.

Btw. all plugins should ship .gz variations as well.

Btw2. here's the line I used to remove them from svn:

for i in $(find -name "*uncompressed*" -not -regex '.*svn.*'); do compressed=${i/uncompressed./}; svn del $compressed; svn del $compressed.gz ; done

-- MichaelDaum - 16 Feb 2010

Ok, fixed up TinyMCEPlugin release branch. This effort has been useful.

I should be able to fix TagMePlugin soon.

-- PaulHarvey - 19 Feb 2010

File src google cc moxiecode mini foswiki mini google % mox %
tiny_mce_src.js 327101 147743 179149 200406 135.6 111.9
plugins/wordcount/editor_plugin_src.js 2534 1241 1517 1595 128.5 105.1
plugins/fullscreen/editor_plugin_src.js 5198 2495 3519 3629 145.5 103.1

Here is a diff on the wordcount plugin:

--- /usr/local/src/   2010-02-19 13:53:29.880445203 +1100
+++ plugins/wordcount/editor_plugin.js   2009-09-22 16:21:00.000000000 +1000
@@ -1,7 +1 @@
-(function(){tinymce.create('tinymce.plugins.WordCount',{block:0,id:null,countre:null,cleanre:null,init:function(ed,url){var t=this,last=0;t.countre=ed.getParam('wordcount_countregex',/\S\s+/g);t.cleanre=ed.getParam('wordcount_cleanregex',/[0-9.(),;:!?%#$�'"_+=\\\/-]*/g);'-word-count';ed.onPostRender.add(function(ed,cm){var row,id;id=ed.getParam('wordcount_target_id');if(!id){row=tinymce.DOM.get('_path_row');if(row)
-tinymce.DOM.add(row.parentNode,'div',{'style':'float: right'},ed.getLang('wordcount.words','Words: ')+'<span id="''">0</span>');}else
-tinymce.DOM.add(id,'span',{},'<span id="''">0</span>');});ed.onInit.add(function(ed){ed.selection.onSetContent.add(function(){t._count(ed);});t._count(ed);});ed.onSetContent.add(function(ed){t._count(ed);});ed.onKeyUp.add(function(ed,e){if(e.keyCode==last)
-t._count(ed);last=e.keyCode;});},_count:function(ed){var t=this,tc=0;if(t.block)
-return;t.block=1;setTimeout(function(){var tx=ed.getContent({format:'raw'});if(tx){tx=tx.replace(/<.[^<>]*?>/g,' ').replace(/&nbsp;|&#160;/gi,' ');tx=tx.replace(t.cleanre,'');tx.replace(t.countre,function(){tc++;});}
-tinymce.DOM.setHTML(,tc.toString());setTimeout(function(){t.block=0;},2000);},1);},getInfo:function(){return{longname:'Word Count plugin',author:'Moxiecode Systems AB',authorurl:'',infourl:'',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('wordcount',tinymce.plugins.WordCount);})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.WordCount",{block:0,id:null,countre:null,cleanre:null,init:function(a,b){var c=this,d=0;c.countre=a.getParam("wordcount_countregex",/\S\s+/g);c.cleanre=a.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$&#65533;'"_+=\\/-]*/g);"-word-count";a.onPostRender.add(function(f,e){var g,h;h=f.getParam("wordcount_target_id");if(!h){g=tinymce.DOM.get("_path_row");if(g){tinymce.DOM.add(g.parentNode,"div",{style:"float: right"},f.getLang("wordcount.words","Words: ")+'<span id="''">0</span>')}}else{tinymce.DOM.add(h,"span",{},'<span id="''">0</span>')}});a.onInit.add(function(e){e.selection.onSetContent.add(function(){c._count(e)});c._count(e)});a.onSetContent.add(function(e){c._count(e)});a.onKeyUp.add(function(f,g){if(g.keyCode==d){return}if(13==g.keyCode||8==d||46==d){c._count(f)}d=g.keyCode})},_count:function(b){var c=this,a=0;if(c.block){return}c.block=1;setTimeout(function(){var d=b.getContent({format:"raw"});if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");d=d.replace(c.cleanre,"");d.replace(c.countre,function(){a++})}tinymce.DOM.setHTML(,a.toString());setTimeout(function(){c.block=0},2000)},1)},getInfo:function(){return{longname:"Word Count plugin",author:"Moxiecode Systems AB",authorurl:"",infourl:"",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("wordcount",tinymce.plugins.WordCount)})();
\ No newline at end of file

Moxiecode uses their in-house jstrim product. As you can see it's doing more than whitespace/comments removal; it seems to be obfuscating variable names too.

I'm not worried about the small size difference. We have more important things to do.

-- PaulHarvey - 19 Feb 2010

Fixed TagMePlugin

-- PaulHarvey - 28 Feb 2010

Rebuilding MANIFEST files is now a bit tedious. Especially large plugins TinyMCEPlugin and JQueryPlugin with many many .css and .js files.

So below are a couple of vim tricks that I finally got working, so that I can reliably rebuild the manifest automatically and apply the following regexes to get the minified/gzipped versions where appropriate

  1. Assume extension directory has all minified and gzipped files removed
  2. Generate a new MANIFEST using ./ manifest
  3. Insert .gz entries for any .css or .js file that does NOT have .uncompressed in their name:
  4. Insert .gz AND minified entries for all .uncompressed.files:
Added a full recipe for updating TinyMCEPlugin at Development.TinyMCEPlugin

I think these features are incomplete

-- PaulHarvey - 17 Mar 2010
Topic revision: r28 - 17 Mar 2010, PaulHarvey - This page was cached on 22 Mar 2018 - 12:59.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License