diff options
author | Einar Egilsson | 2012-01-06 16:25:18 +0100 |
---|---|---|
committer | Einar Egilsson | 2012-01-06 16:25:18 +0100 |
commit | de5fdf8e6a1ef28b0a1acb5ef76eabf7dff0adf5 (patch) | |
tree | 89436ed71ac0281bdd68a0b81607ea87d9f9bfe5 /chrome | |
parent | 9900b37df6394bdf019733decb6ef784dc90a69b (diff) |
Basic CRUD working
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/css/redirector.css | 6 | ||||
-rw-r--r-- | chrome/js/redirector-ui.js | 28 |
2 files changed, 30 insertions, 4 deletions
diff --git a/chrome/css/redirector.css b/chrome/css/redirector.css index 5ebc5f9..382b6a9 100644 --- a/chrome/css/redirector.css +++ b/chrome/css/redirector.css @@ -2,7 +2,7 @@ body { font-family: Tahoma, Arial, sans-serif; font-size:10pt; min-height:100%; - background:-moz-linear-gradient(top, #bcd, #fff); + background:-moz-linear-gradient(top, #AFCFFE,#fff); margin:0; padding:0; } html { @@ -39,7 +39,7 @@ button { border:solid 1px grey; border-radius:4px; background:-moz-linear-gradie h5 { text-align:center; margin:0px; padding-left:130px; } .pattern, .redirectTo { color:blue; font-style:italic;} .exampleUrl, .redirectResult { color:blue; } -#redirect-list li:nth-child(odd) { background:-moz-linear-gradient(top, #ddf, #cce); } +#redirect-list li:nth-child(odd) { background:#e5e5e5; } #redirect-list li:nth-child(even) { background-color:#fff; } #redirect-form div { margin-top:5px; display:table-row; } @@ -48,7 +48,7 @@ h5 { text-align:center; margin:0px; padding-left:130px; } .button-row { text-align:center; display:block !important;} #redirect-form { - background:-moz-linear-gradient(top, #fff, #bcd); + background:-moz-linear-gradient(top,#fff, #AFCFFE); border-radius:8px; display:none; position:fixed; diff --git a/chrome/js/redirector-ui.js b/chrome/js/redirector-ui.js index 643f3f6..79e7fea 100644 --- a/chrome/js/redirector-ui.js +++ b/chrome/js/redirector-ui.js @@ -11,6 +11,7 @@ jQuery.fn.center = function () { } $(document).ready(function() { + $('link').attr('href',$('link').attr('href')+new Date()); var prefs = new RedirectorPrefs(); var strings = StringBundleService.createBundle('chrome://redirector/locale/redirector.properties', LocaleService.getApplicationLocale()); function tr(name) { @@ -121,9 +122,33 @@ $(document).ready(function() { bindRedirect(redirect); $('#redirect-form').center().css('top', '-=40px').show(); } + + function saveRedirect() { + var isNew = !window.editRedirect; + var redirect = isNew ? new Redirect() : window.editRedirect; + redirect.description = $('#description').val(); + redirect.exampleUrl = $('#example-url').val(); + redirect.includePattern = $('#include-pattern').val(); + redirect.excludePattern = $('#exclude-pattern').val(); + redirect.redirectUrl = $('#redirect-to').val(); + redirect.disabled = !$('#redirect-enabled').attr('checked'); + redirect.unescapeMatches = $('#unescape-matches').attr('checked'); + if ($('#regex-pattern').attr('checked')) { + redirect.patternType = Redirect.REGEX; + } else { + redirect.patternType = Redirect.WILDCARD; + } + if (isNew) { + Redirector.addRedirect(redirect); + } + Redirector.save(); + $('#redirect-form').hide(); + databind(); + } $('#redirect-list li div a.edit').live('click', function(ev) { var redirect = $(this.parentNode.parentNode).data('redirect'); + window.editRedirect = redirect; showRedirect(redirect); ev.preventDefault(); }); @@ -131,10 +156,11 @@ $(document).ready(function() { databind(); $('#import').click(importRedirects); $('#export').click(exportRedirects); - $('#new-redirect').click(function() { showRedirect({patternType:Redirect.REGEX});}); + $('#new-redirect').click(function() { window.editRedirect = null; showRedirect({patternType:Redirect.REGEX});}); $('#configure').click(configure); $('#cancel').click(function() { $('#redirect-form').hide();}); $('#configure').click(configure); + $('#save').click(saveRedirect); function configure() { $('#config').show(); |