From e24eba0fc5c45d0a42296ae5ddccc02556afda42 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 18 Jan 2013 18:22:32 +0100 Subject: DOn't use deprecated jQuery.browser, CS fixes (tabs to spaces) --- program/js/googiespell.js | 276 +++++++++++++++++++++++----------------------- 1 file changed, 138 insertions(+), 138 deletions(-) (limited to 'program/js/googiespell.js') diff --git a/program/js/googiespell.js b/program/js/googiespell.js index 478858bac..9832116dd 100644 --- a/program/js/googiespell.js +++ b/program/js/googiespell.js @@ -30,16 +30,16 @@ function GoogieSpell(img_dir, server_url, has_dict) GOOGIE_CUR_LANG = cookie_value != null ? cookie_value : GOOGIE_DEFAULT_LANG; this.array_keys = function(arr) { - var res = []; - for (var key in arr) { res.push([key]); } - return res; + var res = []; + for (var key in arr) { res.push([key]); } + return res; } this.img_dir = img_dir; this.server_url = server_url; this.org_lang_to_word = { - "da": "Dansk", "de": "Deutsch", "en": "English", + "da": "Dansk", "de": "Deutsch", "en": "English", "es": "Español", "fr": "Français", "it": "Italiano", "nl": "Nederlands", "pl": "Polski", "pt": "Português", "ru": "Русский", "fi": "Suomi", "sv": "Svenska" @@ -96,8 +96,8 @@ function GoogieSpell(img_dir, server_url, has_dict) $(document).bind('click', function(e) { var target = $(e.target); if(target.attr('googie_action_btn') != '1' && ref.isLangWindowShown()) - ref.hideLangWindow(); - if(target.attr('googie_action_btn') != '1' && ref.isErrorWindowShown()) + ref.hideLangWindow(); + if(target.attr('googie_action_btn') != '1' && ref.isErrorWindowShown()) ref.hideErrorWindow(); }); @@ -225,8 +225,8 @@ this.escapeSpecial = function(val) this.createXMLReq = function (text) { return '' - + '' - + '' + text + ''; + + '' + + '' + text + ''; }; this.spellCheck = function(ignore) @@ -237,27 +237,27 @@ this.spellCheck = function(ignore) ref = this; $.ajax({ type: 'POST', url: this.getUrl(), data: this.createXMLReq(req_text), dataType: 'text', - error: function(o) { + error: function(o) { if (ref.custom_ajax_error) - ref.custom_ajax_error(ref); + ref.custom_ajax_error(ref); else - alert('An error was encountered on the server. Please try again later.'); + alert('An error was encountered on the server. Please try again later.'); if (ref.main_controller) { - $(ref.spell_span).remove(); - ref.removeIndicator(); + $(ref.spell_span).remove(); + ref.removeIndicator(); } ref.checkSpellingState(); - }, + }, success: function(data) { - ref.processData(data); - if (!ref.results.length) { - if (!ref.custom_no_spelling_error) - ref.flashNoSpellingErrorState(); - else - ref.custom_no_spelling_error(ref); - } - ref.removeIndicator(); - } + ref.processData(data); + if (!ref.results.length) { + if (!ref.custom_no_spelling_error) + ref.flashNoSpellingErrorState(); + else + ref.custom_no_spelling_error(ref); + } + ref.removeIndicator(); + } }); }; @@ -269,14 +269,14 @@ this.learnWord = function(word, id) req_text = '' + word + ''; $.ajax({ type: 'POST', url: this.getUrl(), data: req_text, dataType: 'text', - error: function(o) { + error: function(o) { if (ref.custom_ajax_error) - ref.custom_ajax_error(ref); + ref.custom_ajax_error(ref); else - alert('An error was encountered on the server. Please try again later.'); - }, + alert('An error was encountered on the server. Please try again later.'); + }, success: function(data) { - } + } }); }; @@ -350,9 +350,9 @@ this.parseResult = function(r_text) var only_text = matched_c[i].replace(/<[^>]*>/g, ''), split_t = only_text.split(re_split_text); for (var k=0; k < split_t.length; k++) { - if(split_t[k] != '') - item['suggestions'].push(split_t[k]); - } + if(split_t[k] != '') + item['suggestions'].push(split_t[k]); + } results.push(item); } @@ -363,8 +363,8 @@ this.processData = function(data) { this.results = this.parseResult(data); if (this.results.length) { - this.showErrorsInIframe(); - this.resumeEditingState(); + this.showErrorsInIframe(); + this.resumeEditingState(); } }; @@ -414,7 +414,7 @@ this.createListSeparator = function() tr = document.createElement('tr'); $(td).html(' ').attr('googie_action_btn', '1') - .css({'cursor': 'default', 'font-size': '3px', 'border-top': '1px solid #ccc', 'padding-top': '3px'}); + .css({'cursor': 'default', 'font-size': '3px', 'border-top': '1px solid #ccc', 'padding-top': '3px'}); tr.appendChild(td); return tr; @@ -493,10 +493,10 @@ this.showErrorWindow = function(elm, id) $(item).attr('googie_action_btn', '1').css('cursor', 'default') .mouseover(ref.item_onmouseover) .mouseout(ref.item_onmouseout) - .click(function(e) { - ref.learnWord(elm, id); - ref.ignoreError(elm, id); - }); + .click(function(e) { + ref.learnWord(elm, id); + ref.ignoreError(elm, id); + }); item.appendChild(dummy); row.appendChild(item); @@ -538,14 +538,14 @@ this.showErrorWindow = function(elm, id) revert = document.createElement('td'), rev_span = document.createElement('span'); - $(rev_span).addClass('googie_list_revert').html(this.lang_revert + ' ' + old_value); + $(rev_span).addClass('googie_list_revert').html(this.lang_revert + ' ' + old_value); $(revert).mouseover(this.item_onmouseover).mouseout(this.item_onmouseout) - .click(function(e) { - ref.updateOrginalText(offset, elm.innerHTML, old_value, id); - $(elm).removeAttr('is_corrected').css('color', '#b91414').html(old_value); - ref.hideErrorWindow(); - }); + .click(function(e) { + ref.updateOrginalText(offset, elm.innerHTML, old_value, id); + $(elm).removeAttr('is_corrected').css('color', '#b91414').html(old_value); + ref.hideErrorWindow(); + }); revert.appendChild(rev_span); revert_row.appendChild(revert); @@ -557,7 +557,7 @@ this.showErrorWindow = function(elm, id) edit = document.createElement('td'), edit_input = document.createElement('input'), ok_pic = document.createElement('img'), - edit_form = document.createElement('form'); + edit_form = document.createElement('form'); var onsub = function () { if (edit_input.value != '') { @@ -565,34 +565,34 @@ this.showErrorWindow = function(elm, id) ref.saveOldValue(elm, elm.innerHTML); ref.updateOrginalText(offset, elm.innerHTML, edit_input.value, id); - $(elm).attr('is_corrected', true).css('color', 'green').html(edit_input.value); + $(elm).attr('is_corrected', true).css('color', 'green').html(edit_input.value); ref.hideErrorWindow(); } return false; }; - $(edit_input).width(120).css({'margin': 0, 'padding': 0}); - $(edit_input).val(elm.innerHTML).attr('googie_action_btn', '1'); - $(edit).css('cursor', 'default').attr('googie_action_btn', '1'); + $(edit_input).width(120).css({'margin': 0, 'padding': 0}); + $(edit_input).val(elm.innerHTML).attr('googie_action_btn', '1'); + $(edit).css('cursor', 'default').attr('googie_action_btn', '1'); - $(ok_pic).attr('src', this.img_dir + 'ok.gif') - .width(32).height(16) - .css({'cursor': 'pointer', 'margin-left': '2px', 'margin-right': '2px'}) - .click(onsub); + $(ok_pic).attr('src', this.img_dir + 'ok.gif') + .width(32).height(16) + .css({'cursor': 'pointer', 'margin-left': '2px', 'margin-right': '2px'}) + .click(onsub); $(edit_form).attr('googie_action_btn', '1') - .css({'margin': 0, 'padding': 0, 'cursor': 'default', 'white-space': 'nowrap'}) - .submit(onsub); + .css({'margin': 0, 'padding': 0, 'cursor': 'default', 'white-space': 'nowrap'}) + .submit(onsub); - edit_form.appendChild(edit_input); - edit_form.appendChild(ok_pic); + edit_form.appendChild(edit_input); + edit_form.appendChild(ok_pic); edit.appendChild(edit_form); edit_row.appendChild(edit); list.appendChild(edit_row); // Append extra menu items if (this.extra_menu_items.length > 0) - list.appendChild(this.createListSeparator()); + list.appendChild(this.createListSeparator()); var loop = function(i) { if (i < ref.extra_menu_items.length) { @@ -602,12 +602,12 @@ this.showErrorWindow = function(elm, id) var e_row = document.createElement('tr'), e_col = document.createElement('td'); - $(e_col).html(e_elm[0]) + $(e_col).html(e_elm[0]) .mouseover(ref.item_onmouseover) - .mouseout(ref.item_onmouseout) - .click(function() { return e_elm[1](elm, ref) }); + .mouseout(ref.item_onmouseout) + .click(function() { return e_elm[1](elm, ref) }); - e_row.appendChild(e_col); + e_row.appendChild(e_col); list.appendChild(e_row); } loop(i+1); @@ -619,7 +619,7 @@ this.showErrorWindow = function(elm, id) //Close button if (this.use_close_btn) { - list.appendChild(this.createCloseButton(this.hideErrorWindow)); + list.appendChild(this.createCloseButton(this.hideErrorWindow)); } } @@ -637,17 +637,17 @@ this.showErrorWindow = function(elm, id) $(this.error_window).css({'top': top+'px', 'left': left+'px'}).show(); // Dummy for IE - dropdown bug fix - if ($.browser.msie) { - if (!this.error_window_iframe) { + if (document.all && !window.opera) { + if (!this.error_window_iframe) { var iframe = $('