Changeset 9245
- Timestamp:
- 04/10/08 14:25:05 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/gmperator.js
r9102 r9245 31 31 * And cannot get back. 32 32 * 33 * e x)33 * e.g.) 34 34 * :gmset! {filename} -n fooScriptName -i http://*,https://* -e http://example.com/* 35 35 * toggle enable or disable, … … 44 44 * {{{ 45 45 * 46 * 1). can access to the sandbox of Greasemonkey !!!47 * 2). can register commands whichexecute46 * 1). you can access to the sandbox of Greasemonkey !!! 47 * 2). you can register commands to execute 48 48 * when the user script is executed on the URI 49 49 * @see liberator.plugins.gmperator.addAutoCommand … … 67 67 * ) 68 68 * addAutoCommand : function( uri, script, cmd ) 69 * If both of uri and script is match69 * If both of uri and script are matched 70 70 * 71 71 * ) … … 89 89 // ----------------------- 90 90 // {{{ 91 var manager = {91 var manager = { 92 92 register: function (uri,sandbox,script){ 93 93 var panelID = getPanelID(sandbox.window); … … 98 98 gmCon = new GmContainer(uri,sandbox); 99 99 containers[panelID] = gmCon; 100 this.__defineGetter__(panelID,function() {return gmCon;});101 log('gmpeartor: redisted: '+ panelID + ' - ' + uri);100 this.__defineGetter__(panelID,function() gmCon); 101 log('gmpeartor: Registered: ' + panelID + ' - ' + uri); 102 102 } 103 103 gmCon.sandbox = sandbox; … … 106 106 autocommands.trigger('GMInjectedScript',uri+'\n'+script.filename); 107 107 }, 108 get gmScripts(){ 109 return getScripts(); 110 }, 111 get allItem(){ 112 return containers; 113 }, 114 get currentPanel(){ 115 return getBrowser().mCurrentTab.linkedPanel; 116 }, 117 get currentContainer(){ 118 return containers[this.currentPanel] || null; 119 }, 108 get gmScripts() getScripts(), 109 get allItem() containers, 110 get currentPanel() getBrowser().mCurrentTab.linkedPanel, 111 get currentContainer() containers[this.currentPanel] || null, 120 112 get currentSandbox(){ 121 113 var id = this.currentPanel; … … 171 163 } 172 164 } 173 liberator.log(win + 'is no found');165 liberator.log(win + 'is not found'); 174 166 } 175 167 function updateGmContainerList(e){ … … 193 185 var scripts = getScripts(); 194 186 var reg; 195 var table, tr;196 187 if (special || arg == 'full'){ 197 188 reg = new RegExp('.*'); … … 206 197 } 207 198 } else { 208 table = <table/>; 199 var table = <table/>; 200 var tr; 209 201 for each(var script in scripts){ 210 202 tr = <tr/>; … … 231 223 var contents = script[prop.toLowerCase()]; 232 224 if (typeof contents == "string"){ 233 tr.* += < >{contents}</>;225 tr.* += <td>{contents}</td>; 234 226 } else { 227 var td = <td/>; 235 228 contents.forEach(function(c,i,a){ 236 t r.* += <>{c}</>;237 if (a[i+1]) t r.* += <br/>;229 td.* += c; 230 if (a[i+1]) td.* += <br/>; 238 231 }); 232 tr.* += td; 239 233 } 240 234 table.* += tr; … … 284 278 */ 285 279 },{ 286 completer: function(filter){ 287 return scriptsCompleter(filter,true); 288 } 280 completer: function(filter) scriptsCompleter(filter,true) 289 281 } 290 282 ); //}}} … … 330 322 'Caution: the change is permanent, not the only session.<br/>And cannot get back.' 331 323 ].join(''), 332 completer: function(filter){ 333 return scriptsCompleter(filter, false); 334 } 324 completer: function(filter) 325 scriptsCompleter(filter, false) 335 326 } 336 327 ); //}}} … … 350 341 } 351 342 GmContainer.prototype = { 352 addScript : function(script){ 353 if (this.hasScript(script)) return false; 354 355 return this.scripts.push(script); 356 }, 343 addScript : function(script) !this.hasScript(script) && this.scripts.push(script) || false, 357 344 hasScript : function(script){ 358 345 var filename; … … 362 349 default: return null; 363 350 } 364 return this.scripts.some(function(s) { return s.filename == filename; });365 } 366 } // }}}351 return this.scripts.some(function(s) s.filename == filename); 352 } 353 }; // }}} 367 354 function getScripts(){ //{{{ 368 355 var config = new Config();
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)