forked from jayallen/melody
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#388 state:resolved] Updated to latest version of Config Assistant w…
…hich improves cross Melody and MT compatibility.
- Loading branch information
1 parent
5c1de5e
commit f4ef495
Showing
5 changed files
with
56 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Utility Functions | ||
function handle_edit_click() { | ||
var link = $(this).parent().find('a.link'); | ||
if (link.length > 0) { | ||
$(this).parent().replaceWith( render_link_form( link.html(), link.attr('href') ) ); | ||
} else { | ||
$(this).parent().before( render_link_form( '','' ) ); | ||
$(this).parent().hide(); | ||
} | ||
return false; | ||
}; | ||
function render_link(label,url) { | ||
var dom = '<li class="pkg"><a class="link" href="'+url+'">'+label+'</a> <a class="remove" href="javascript:void(0);"><img src="'+StaticURI+'images/icon_close.png" /></a> <a class="edit" href="javascript:void(0);">edit</a></li>'; | ||
var e = $(dom); | ||
e.find('a.edit').click( handle_edit_click ); | ||
e.find('a.remove').click( handle_delete_click ); | ||
return e; | ||
}; | ||
function handle_save_click() { | ||
var label = $(this).parent().find('input[class=label]').val(); | ||
var url = $(this).parent().find('input[class=url]').val(); | ||
if (!label && !url) { return false; } | ||
$(this).parents('ul').find('li.last').show(); | ||
$(this).parent().replaceWith( render_link(label,url) ); | ||
return false; | ||
}; | ||
function handle_delete_click() { | ||
$(this).parent().remove(); return false; | ||
}; | ||
function render_link_form(label,url) { | ||
var dom = '<li class="pkg"><label class="link-text">Label: <input type="text" class="label" value="'+(typeof label != 'undefined' ? label : '')+'" /></label><label class="link-url">URL: <input type="text" class="url" value="'+(typeof url != 'undefined' ? url : '')+'" /></label> <button>Save</button></li>'; | ||
var e = $(dom); | ||
e.find('button').click( handle_save_click ); | ||
e.find('input.url').focus( function() { | ||
$(this).bind('keypress', function(event) { | ||
if (event.keyCode == 13) { | ||
event.stopPropagation(); | ||
e.find('button').trigger('click'); | ||
return false; | ||
} | ||
}); | ||
}).blur( function() { | ||
$(this).unbind('keypress'); | ||
}); | ||
return e; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters