From 22bf43619951644af1b4ad28024659e9d5848d61 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 24 Jan 2013 12:47:51 +0900 Subject: [PATCH] searchbar: fix jslint errors 'toggleClear' was used before it was defined. toggleClear(); // Line 145, Pos 13 'makeFrontIcon' was used before it was defined. makeFrontIcon(); // Line 154, Pos 17 'hideCancel' was used before it was defined. hideCancel(); // Line 172, Pos 29 'showCancel' was used before it was defined. showCancel(); // Line 190, Pos 25 'toggleClear' was used before it was defined. function toggleClear() { // Line 242, Pos 22 Expected 'cancelbtn' at column 17, not column 21. cancelbtn // Line 252, Pos 21 Expected 'cancelbtn' at column 17, not column 21. cancelbtn // Line 261, Pos 21 'makeFrontIcon' was used before it was defined. function makeFrontIcon() { // Line 267, Pos 22 Expected ';' and instead saw '$'. this.element.parent().parent().find(".ui-input-cancel").removeClass( "ui-disabled" ) // Line 292, Pos 97 Change-Id: Ia4dcae9bb0b267da5fba108d28d4b56a6bb8c436 --- .../searchbar/js/jquery.mobile.tizen.searchbar.js | 82 +++++++++++----------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/src/widgets/searchbar/js/jquery.mobile.tizen.searchbar.js b/src/widgets/searchbar/js/jquery.mobile.tizen.searchbar.js index 6a134c4..8ad0bd3 100755 --- a/src/widgets/searchbar/js/jquery.mobile.tizen.searchbar.js +++ b/src/widgets/searchbar/js/jquery.mobile.tizen.searchbar.js @@ -102,8 +102,6 @@ $( "label[for='" + input.attr( "id" ) + "']" ).addClass( "ui-input-text" ); -// focusedEl = input.addClass( "ui-input-text ui-body-" + theme ); - if ( typeof input[0].autocorrect !== "undefined" && !$.support.touchOverflow ) { // Set the attribute instead of the property just in case there // is code that attempts to make modifications via HTML. @@ -142,6 +140,45 @@ shadow: true }); + function toggleClear() { + setTimeout(function () { + clearbtn.toggleClass( "ui-input-clear-hidden", !input.val() ); + }, 0); + } + + function showCancel() { + focusedEl + .addClass( "ui-input-search-default" ) + .removeClass( "ui-input-search-wide" ); + cancelbtn + .addClass( "ui-btn-cancel-show" ) + .removeClass( "ui-btn-cancel-hide" ); + } + + function hideCancel() { + focusedEl + .addClass( "ui-input-search-wide" ) + .removeClass( "ui-input-search-default" ); + cancelbtn + .addClass( "ui-btn-cancel-hide" ) + .removeClass( "ui-btn-cancel-show" ); + toggleClear(); + } + + function makeFrontIcon() { + var IconStyle = $( input ).jqmData( "icon" ), + frontIcon = $( "
" ); + + frontIcon + .appendTo( focusedEl.parent() ) + .buttonMarkup( { + icon: IconStyle, + corners: true, + shadow: true + } ); + frontIcon.addClass( "ui-btn-search-front-icon" ); + } + toggleClear(); input.bind( 'paste cut keyup focus change blur', toggleClear ); @@ -238,45 +275,6 @@ if ( !input.attr("placeholder") ) { input.attr( "placeholder", "Search" ); } - - function toggleClear() { - setTimeout(function () { - clearbtn.toggleClass( "ui-input-clear-hidden", !input.val() ); - }, 0); - } - - function showCancel() { - focusedEl - .addClass( "ui-input-search-default" ) - .removeClass( "ui-input-search-wide" ); - cancelbtn - .addClass( "ui-btn-cancel-show" ) - .removeClass( "ui-btn-cancel-hide" ); - } - - function hideCancel() { - focusedEl - .addClass( "ui-input-search-wide" ) - .removeClass( "ui-input-search-default" ); - cancelbtn - .addClass( "ui-btn-cancel-hide" ) - .removeClass( "ui-btn-cancel-show" ); - toggleClear(); - } - - function makeFrontIcon() { - var IconStyle = $( input ).jqmData( "icon" ), - frontIcon = $( "
" ); - - frontIcon - .appendTo( focusedEl.parent() ) - .buttonMarkup( { - icon: IconStyle, - corners: true, - shadow: true - } ); - frontIcon.addClass( "ui-btn-search-front-icon" ); - } }, disable: function () { @@ -289,7 +287,7 @@ enable: function () { this.element.attr( "disabled", false ); this.element.parent().removeClass( "ui-disabled" ); - this.element.parent().parent().find(".ui-input-cancel").removeClass( "ui-disabled" ) + this.element.parent().parent().find(".ui-input-cancel").removeClass( "ui-disabled" ); $( this.element ).focus(); } } ); -- 2.7.4