Changeset 23736 for lang/javascript/jarminal
- Timestamp:
- 11/15/08 01:22:52 (8 weeks ago)
- Location:
- lang/javascript/jarminal/trunk/src
- Files:
-
- 4 modified
-
LICENSE (modified) (1 prop)
-
command/standard.js (modified) (1 prop)
-
jarminal.js (modified) (10 diffs, 1 prop)
-
ui/jquery/ui.jarminal.js (modified) (7 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/jarminal/trunk/src/LICENSE
- Property svn:executable deleted
-
lang/javascript/jarminal/trunk/src/command/standard.js
- Property svn:executable deleted
-
lang/javascript/jarminal/trunk/src/jarminal.js
- Property svn:executable deleted
r19267 r23736 1 1 /** 2 2 * Jarminal 3 * 3 * 4 4 * JavaScript Shell tool 5 5 * used jQuery UI Dialog or other UI … … 21 21 options : {}, 22 22 scope : { 23 history : [{name : 'window', obj : window}],24 down : function(name ,obj){23 history : [{name : 'window', obj : window}], 24 down : function(name, obj){ 25 25 this.history.push({name : name, obj : obj}); 26 26 }, … … 28 28 this.history.pop(); 29 29 }, 30 change : function(name ,obj){30 change : function(name, obj){ 31 31 this.history = [{name : name, obj : obj}]; 32 32 }, … … 74 74 this.UI.create(); 75 75 } 76 this.UI.opened ? this.UI.close() : this.UI.open();76 this.UI.opened ? this.UI.close() : this.UI.open(); 77 77 }, 78 78 79 79 input : function(str){ 80 80 81 81 var args = []; 82 var match = str.match(/(["']?)((?:\\.|[^\\])*?)\1(?:\s+|$)/g);//"])) syntax color83 82 var match = str.match(/(["']?)((?:\\.|[^\\])*?)\1(?:\s+|$)/g); //"])) syntax color 83 84 84 for(var i=0,l=match.length; i<l; i++){ 85 85 var arg = match[i].replace(/^\s+|\s+$/g, ''); … … 93 93 var request = new this.Request({ 94 94 input : str 95 }) 95 }); 96 96 if(this._command.list[command]){ 97 97 request.merge({ … … 127 127 } 128 128 }), 129 129 130 130 init : new Jsob({ 131 131 initialize : function(){ 132 132 this.setEvent(); 133 }}, {134 setEvent : ['later' , function(){133 }}, { 134 setEvent : ['later', function(){ 135 135 jQuery(document.body).dblclick(function (){ 136 jarminal.show.apply(jarminal, arguments);136 jarminal.show.apply(jarminal, arguments); 137 137 }); 138 138 }] … … 158 158 dragStop : new Jsob(), 159 159 //ui input area focu & blur 160 focus : new Jsob(),161 blur : new Jsob()160 focus : new Jsob(), 161 blur : new Jsob() 162 162 }; 163 163 … … 183 183 //get input text from UI 184 184 input : function(){}, 185 //reset input text 185 //reset input text 186 186 resetInput : function(){}, 187 187 //set input text … … 230 230 * TODO : output plugin file 231 231 */ 232 Jarminal.prototype._command ={232 Jarminal.prototype._command = { 233 233 defaults : {}, 234 234 create : function(){ … … 253 253 // Version 0.2 254 254 // Copyright (c) 2005-2007 KOSEKI Kengo 255 // 255 // 256 256 // This script is distributed under the MIT licence. 257 257 // http://www.opensource.org/licenses/mit-license.php 258 259 function Selection(textareaElement) {258 259 function Selection(textareaElement){ 260 260 this.element = textareaElement; 261 261 } 262 263 Selection.prototype.create = function() {264 if (document.selection != null && this.element.selectionStart == null){262 263 Selection.prototype.create = function(){ 264 if(document.selection != null && this.element.selectionStart == null){ 265 265 return this._ieGetSelection(); 266 } else{266 }else{ 267 267 return this._mozillaGetSelection(); 268 268 } 269 } 270 271 Selection.prototype._mozillaGetSelection = function() {272 return { 273 start : this.element.selectionStart,274 end : this.element.selectionEnd269 }; 270 271 Selection.prototype._mozillaGetSelection = function(){ 272 return { 273 start : this.element.selectionStart, 274 end : this.element.selectionEnd 275 275 }; 276 } 277 278 Selection.prototype._ieGetSelection = function() {276 }; 277 278 Selection.prototype._ieGetSelection = function(){ 279 279 this.element.focus(); 280 280 281 281 var range = document.selection.createRange(); 282 282 var bookmark = range.getBookmark(); 283 283 284 284 var contents = this.element.value; 285 285 var originalContents = contents; 286 286 var marker = this._createSelectionMarker(); 287 while(contents.indexOf(marker) != -1) {287 while(contents.indexOf(marker) != -1){ 288 288 marker = this._createSelectionMarker(); 289 289 } 290 290 291 291 var parent = range.parentElement(); 292 if (parent == null || parent.type != "textarea"){293 return { start : 0, end: 0 };292 if(parent == null || parent.type != 'textarea'){ 293 return { start : 0, end : 0 }; 294 294 } 295 295 range.text = marker + range.text + marker; 296 296 contents = this.element.value; 297 297 298 298 var result = {}; 299 299 result.start = contents.indexOf(marker); 300 contents = contents.replace(marker, "");300 contents = contents.replace(marker, ''); 301 301 result.end = contents.indexOf(marker); 302 302 303 303 this.element.value = originalContents; 304 304 range.moveToBookmark(bookmark); 305 305 range.select(); 306 306 307 307 return result; 308 } 309 310 Selection.prototype._createSelectionMarker = function() {311 return "##SELECTION_MARKER_" + Math.random() + "##";312 } 308 }; 309 310 Selection.prototype._createSelectionMarker = function(){ 311 return '##SELECTION_MARKER_' + Math.random() + '##'; 312 }; 313 313 314 314 }()); -
lang/javascript/jarminal/trunk/src/ui/jquery/ui.jarminal.js
- Property svn:executable deleted
r19267 r23736 5 5 jarminal.UI = { 6 6 7 //create UI 8 create : function(){7 //create UI 8 create : function(){ 9 9 var self = this; 10 10 //create element 11 11 jQuery(document.body) 12 .append('<div id="terminal"><fieldset><textarea id="jarminal-view" ></textarea></fieldset><div id="jarminal-scope">window></div><fieldset><textarea id="jarminal-input"></textarea></fieldset></div>');12 .append('<div id="terminal"><fieldset><textarea id="jarminal-view"/></fieldset><div id="jarminal-scope">window></div><fieldset><textarea id="jarminal-input"/></fieldset></div>'); 13 13 14 14 //set focus event … … 66 66 this.resize(); 67 67 68 jQuery('.ui-dialog').append('<div id="ui-bg" />');68 jQuery('.ui-dialog').append('<div id="ui-bg"/>'); 69 69 jQuery('#ui-bg').css({ 70 backgroundColor :'#000000',71 height :'100%',72 position :'absolute',73 top :'0pt',74 width :'100%',75 zIndex :'0',70 backgroundColor : '#000000', 71 height : '100%', 72 position : 'absolute', 73 top : '0pt', 74 width : '100%', 75 zIndex : '0', 76 76 opacity : 0.6 77 77 }); … … 99 99 }); 100 100 101 //style 101 //style 102 102 jQuery('#jarminal-view,#jarminal-scope,#jarminal-input') 103 103 .css({ … … 105 105 color : '#FFF', 106 106 width : '100%', 107 margin:'0px'108 107 margin : '0px' 108 109 109 }); 110 110 jQuery('#jarminal-view,#jarminal-input') … … 161 161 this.resetInput(); 162 162 }, 163 163 164 164 lineBreak : function(){ 165 165 //TODO : bugfix on ie … … 201 201 //get input text from UI 202 202 input : function(){ 203 return jQuery('#jarminal-input').attr('value').replace(/[\r\n]/g,'');204 }, 205 206 //reset input text 203 return jQuery('#jarminal-input').attr('value').replace(/[\r\n]+/g,''); 204 }, 205 206 //reset input text 207 207 resetInput : function(){ 208 208 jQuery('#jarminal-input').attr('value', '' ); … … 213 213 jQuery('#jarminal-input').attr('value', str ); 214 214 }, 215 215 216 216 //add input text 217 217 addInput : function(str){
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)