Skip to content
This repository has been archived by the owner on Oct 27, 2019. It is now read-only.

Commit

Permalink
Moved more stuff + a wee bit o' cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
subtleGradient committed Jul 28, 2008
1 parent 42a944e commit f56290e
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 78 deletions.
73 changes: 0 additions & 73 deletions Support/git.gui.js
@@ -1,79 +1,6 @@
// -*- Mode: MooTools; tab-width: 4; -*-
// requires 'gui.js'

function GUI(command, options) {
options = $merge({
logElement:$$('#log .log')[0],
errElement:$$('#log .errors')[0]
}, options);

cmd = new ShellScript('"$TM_BUNDLE_SUPPORT/'+ $GUI$ +'.gui.rb" '+command, options);
cmd.draw(command);

return cmd;
}

function GUI_info(command, options) {
return GUI(command, $merge({
logElement:$$('#info .server')[0],
errElement:$$('#info .server')[0],
nobusy:true
}, options));
}

function ShellScriptResult(command) {
result = '';
result += TextMate.system(command,null).outputString;
return result;
}

function cache_info(command) {
// $try( $(command).destroy() );
c=$(command); if(c) return c.get('html');

GUI_info(command,{
logElement: new Element('div',{'id':command, 'class':'data',
'text':ShellScriptResult(command)
}).inject(document.body)
}).run().hide();

return $(command).get('html');
}

function browse(url){
try{
$('browser').destroy();
}catch(e){};

new Element('iframe', {'id':'browser', 'class': "browser", src: url, 'html':'' }).inject(document.body, 'top');
}

function GUI_toggle(name, ele, mode) {
button = new Element('input',{
type:'button',
value: name,
accesskey: ShellScript.key(name),
}).inject('toolbar');

if(mode== 'class'){
button.addEvent('click', function(e){
e = $(ele);
if(e.hasClass('on')){
e.removeClass('on');
e.addClass('off');
}else{
e.removeClass('off');
e.addClass('on');
};
});
};

// button.value=

return button

}

window.addEvent('domready',function(){
try{
$GUI$ = 'git'
Expand Down
81 changes: 76 additions & 5 deletions Support/gui.js
Expand Up @@ -11,7 +11,7 @@ ShellScript.implement({
if(!$('choosr')){
new Element('select',{id:'choosr',title:'The first uppercase character in the option is the ctrl shortcut'})
.adopt([
new Element('option',{value:'0',text:' Commands'}),
new Element('option',{value:'0',text:' Commands'})
])
.inject('toolbar')
.store('script',{});
Expand All @@ -24,7 +24,7 @@ ShellScript.implement({
this.value=0;
}
event.stop();
},
}
}).focus();
}).delay(1);
};
Expand All @@ -42,7 +42,7 @@ ShellScript.implement({
return this;
},
key: function(name){
return $$('[accesskey="'+ name[0] +'"]').length ? this.key(name[1]) : name[0]
return $$('[accesskey="'+ name[0] +'"]').length ? this.key(name[1]) : name[0];
},
draw: function(name){
this.button = new Element('input',{
Expand All @@ -54,7 +54,7 @@ ShellScript.implement({

this.button.store('script',this);

this.button.addEvent('click', function(){ if( this.value == name) this.retrieve('script').run() });
this.button.addEvent('click', function(){ if( this.value == name) this.retrieve('script').run(); });
// this.button.addEvent('click', function(){ console.log('click'); });
// this.button.addEvent('click delay', function(){ console.log('click delay'); });
// this.button.addEvent('click', function(){ setTimeout(function(){ this.fireEvent('click delay') }.bind(this), 1 *1000); });
Expand All @@ -65,5 +65,76 @@ ShellScript.implement({
this.draw_menu(name);

this.button.inject('toolbar');
},
}
});

function GUI(command, options) {
options = $merge({
logElement:$$('#log .log')[0],
errElement:$$('#log .errors')[0]
}, options);

cmd = new ShellScript('"$TM_BUNDLE_SUPPORT/'+ $GUI$ +'.gui.rb" '+command, options);
cmd.draw(command);

return cmd;
}

function GUI_info(command, options) {
return GUI(command, $merge({
logElement:$$('#info .server')[0],
errElement:$$('#info .server')[0],
nobusy:true
}, options));
}

function ShellScriptResult(command) {
result = '';
result += TextMate.system(command,null).outputString;
return result;
}

function cache_info(command) {
// $try( $(command).destroy() );
c=$(command); if(c) return c.get('html');

GUI_info(command,{
logElement: new Element('div',{'id':command, 'class':'data',
'text':ShellScriptResult(command)
}).inject(document.body)
}).run().hide();

return $(command).get('html');
}

function browse(url){
try{
$('browser').destroy();
}catch(e){};

new Element('iframe', {'id':'browser', 'class': "browser", src: url, 'html':'' }).inject(document.body, 'top');
}

function GUI_toggle(name, ele, mode) {
button = new Element('input',{
type:'button',
value: name,
accesskey: ShellScript.key(name)
}).inject('toolbar');

if(mode== 'class'){
button.addEvent('click', function(e){
e = $(ele);
if(e.hasClass('on')){
e.removeClass('on');
e.addClass('off');
}else{
e.removeClass('off');
e.addClass('on');
};
});
};

return button;
}

0 comments on commit f56290e

Please sign in to comment.