Show
Ignore:
Timestamp:
11/15/08 01:22:52 (8 weeks ago)
Author:
drry
Message:
  • fixed a regex.
  • removed subversion properties.
  • et cetera.
Location:
lang/javascript/jarminal/trunk/src
Files:
4 modified

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  
    11/** 
    22 * Jarminal 
    3  *  
     3 * 
    44 * JavaScript Shell tool 
    55 * used jQuery UI Dialog or other UI 
     
    2121        options : {}, 
    2222        scope : { 
    23             history : [{name : 'window', obj: window}], 
    24             down : function(name ,obj){ 
     23            history : [{name : 'window', obj : window}], 
     24            down : function(name, obj){ 
    2525                this.history.push({name : name, obj : obj}); 
    2626            }, 
     
    2828                this.history.pop(); 
    2929            }, 
    30             change : function(name ,obj){ 
     30            change : function(name, obj){ 
    3131                this.history = [{name : name, obj : obj}]; 
    3232            }, 
     
    7474                this.UI.create(); 
    7575            } 
    76             this.UI.opened ? this.UI.close()  : this.UI.open()  ; 
     76            this.UI.opened ? this.UI.close() : this.UI.open(); 
    7777        }, 
    7878 
    7979        input : function(str){ 
    80              
     80 
    8181            var args = []; 
    82             var match =  str.match(/(["']?)((?:\\.|[^\\])*?)\1(?:\s+|$)/g);   //"])) syntax color 
    83              
     82            var match = str.match(/(["']?)((?:\\.|[^\\])*?)\1(?:\s+|$)/g);    //"])) syntax color 
     83 
    8484            for(var i=0,l=match.length; i<l; i++){ 
    8585                var arg = match[i].replace(/^\s+|\s+$/g, ''); 
     
    9393            var request = new this.Request({ 
    9494                input : str 
    95             }) 
     95            }); 
    9696            if(this._command.list[command]){ 
    9797                request.merge({ 
     
    127127            } 
    128128        }), 
    129      
     129 
    130130        init : new Jsob({ 
    131131            initialize : function(){ 
    132132                this.setEvent(); 
    133             }},{ 
    134             setEvent : ['later' , function(){ 
     133            }}, { 
     134            setEvent : ['later', function(){ 
    135135                jQuery(document.body).dblclick(function (){ 
    136                     jarminal.show.apply(jarminal,arguments); 
     136                    jarminal.show.apply(jarminal, arguments); 
    137137                }); 
    138138            }] 
     
    158158        dragStop    : new Jsob(), 
    159159        //ui input area focu & blur 
    160         focus   : new Jsob(), 
    161         blur    : new Jsob() 
     160        focus       : new Jsob(), 
     161        blur        : new Jsob() 
    162162    }; 
    163163 
     
    183183        //get input text from UI 
    184184        input       : function(){}, 
    185         //reset input text  
     185        //reset input text 
    186186        resetInput  : function(){}, 
    187187        //set input text 
     
    230230     * TODO : output plugin file 
    231231     */ 
    232     Jarminal.prototype._command={ 
     232    Jarminal.prototype._command = { 
    233233        defaults : {}, 
    234234        create : function(){ 
     
    253253    // Version 0.2 
    254254    // Copyright (c) 2005-2007 KOSEKI Kengo 
    255     //  
     255    // 
    256256    // This script is distributed under the MIT licence. 
    257257    // http://www.opensource.org/licenses/mit-license.php 
    258      
    259     function Selection(textareaElement) { 
     258 
     259    function Selection(textareaElement){ 
    260260        this.element = textareaElement; 
    261261    } 
    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){ 
    265265            return this._ieGetSelection(); 
    266         } else { 
     266        }else{ 
    267267            return this._mozillaGetSelection(); 
    268268        } 
    269     } 
    270      
    271     Selection.prototype._mozillaGetSelection = function() { 
    272         return {  
    273             start: this.element.selectionStart,  
    274             end: this.element.selectionEnd  
     269    }; 
     270 
     271    Selection.prototype._mozillaGetSelection = function(){ 
     272        return { 
     273            start : this.element.selectionStart, 
     274            end   : this.element.selectionEnd 
    275275        }; 
    276     } 
    277      
    278     Selection.prototype._ieGetSelection = function() { 
     276    }; 
     277 
     278    Selection.prototype._ieGetSelection = function(){ 
    279279        this.element.focus(); 
    280      
     280 
    281281        var range = document.selection.createRange(); 
    282282        var bookmark = range.getBookmark(); 
    283      
     283 
    284284        var contents = this.element.value; 
    285285        var originalContents = contents; 
    286286        var marker = this._createSelectionMarker(); 
    287         while(contents.indexOf(marker) != -1) { 
     287        while(contents.indexOf(marker) != -1){ 
    288288            marker = this._createSelectionMarker(); 
    289289        } 
    290      
     290 
    291291        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 }; 
    294294        } 
    295295        range.text = marker + range.text + marker; 
    296296        contents = this.element.value; 
    297      
     297 
    298298        var result = {}; 
    299299        result.start = contents.indexOf(marker); 
    300         contents = contents.replace(marker, ""); 
     300        contents = contents.replace(marker, ''); 
    301301        result.end = contents.indexOf(marker); 
    302      
     302 
    303303        this.element.value = originalContents; 
    304304        range.moveToBookmark(bookmark); 
    305305        range.select(); 
    306      
     306 
    307307        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    }; 
    313313 
    314314}()); 
  • lang/javascript/jarminal/trunk/src/ui/jquery/ui.jarminal.js

    • Property svn:executable deleted
    r19267 r23736  
    55jarminal.UI = { 
    66 
    7     //create UI  
    8     create :  function(){ 
     7    //create UI 
     8    create : function(){ 
    99        var self = this; 
    1010        //create element 
    1111        jQuery(document.body) 
    12         .append('<div id="terminal"><fieldset><textarea id="jarminal-view"></textarea></fieldset><div id="jarminal-scope">window&gt;</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&gt;</div><fieldset><textarea id="jarminal-input"/></fieldset></div>'); 
    1313 
    1414        //set focus event 
     
    6666        this.resize(); 
    6767 
    68         jQuery('.ui-dialog').append('<div id="ui-bg" />'); 
     68        jQuery('.ui-dialog').append('<div id="ui-bg"/>'); 
    6969        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', 
    7676            opacity : 0.6 
    7777        }); 
     
    9999        }); 
    100100 
    101         //style  
     101        //style 
    102102        jQuery('#jarminal-view,#jarminal-scope,#jarminal-input') 
    103103        .css({ 
     
    105105            color : '#FFF', 
    106106            width : '100%', 
    107               margin:'0px' 
    108              
     107            margin : '0px' 
     108 
    109109        }); 
    110110        jQuery('#jarminal-view,#jarminal-input') 
     
    161161        this.resetInput(); 
    162162    }, 
    163      
     163 
    164164    lineBreak : function(){ 
    165165        //TODO : bugfix on ie 
     
    201201    //get input text from UI 
    202202    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 
    207207    resetInput : function(){ 
    208208        jQuery('#jarminal-input').attr('value', '' ); 
     
    213213        jQuery('#jarminal-input').attr('value', str ); 
    214214    }, 
    215      
     215 
    216216    //add input text 
    217217    addInput : function(str){