Completed
Push — release/1.0.3 ( 736428 )
by Tristan
12:40
created

?!?.C14S   B

Complexity

Conditions 7
Paths 8

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 1
nc 8
nop 1
dl 0
loc 1
rs 8
c 0
b 0
f 0
1
!function(t){var e={};function o(s){if(e[s])return e[s].exports;var i=e[s]={i:s,l:!1,exports:{}};return t[s].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=t,o.c=e,o.d=function(t,e,s){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=2)}({2:function(t,e,o){t.exports=o("C14S")},C14S:function(t,e){$(document).ready(function(){var t=$(".js-combobox"),e=$("body"),o=[];function s(){$("#js-codeit").html("You have to code a function or a redirection to display more results ;)")}t.length&&(t.each(function(t){var e=$(this),s=e.attr("id"),i=$('label[for="'+s+'"]'),n=t+1,a=e.data(),r=void 0!==a.comboboxPrefixClass?a.comboboxPrefixClass+"-":"",l=void 0!==a.comboboxHelpText?a.comboboxHelpText:"",u=$("#"+e.attr("list")),d=void 0!==a.comboboxButtonTitle?a.comboboxButtonTitle:"clear this field",c=void 0!==a.comboboxButtonText?a.comboboxButtonText:"X",b=void 0!==a.comboboxCaseSensitive?a.comboboxCaseSensitive:"no",f=[];e.attr({"data-number":n,autocorrect:"off",autocapitalize:"off",spellcheck:"false",autocomplete:"off","aria-describedby":r+"help-text"+n,"aria-autocomplete":"list","data-lastval":"","aria-owns":r+"suggest_"+n}),u.find("option").each(function(t,e){f.push(e.value)}),o[n]="no"===b?f.sort(function(t,e){return(t=t.toLowerCase())==(e=e.toLowerCase())?0:t>e?1:-1}):f.sort(),e.wrap('<div class="'+r+'container js-container" data-combobox-prefix-class="'+r+'"></div>');var g=e.parent();g.append('<div id="'+r+"suggest_"+n+'" class="js-suggest '+r+'suggestions"><div role="listbox"></div></div>'),u.remove(),g.prepend('<span id="'+r+"help-text"+n+'" class="'+r+'help-text invisible">'+l+"</span>"),i.attr("id","label-id-"+s),e.after('<button class="js-clear-button '+r+'clear-button" aria-label="'+d+'" title="'+d+'" aria-describedby="label-id-'+s+'" type="button">'+c+"</button>")}),e.on("keyup",".js-combobox",function(t){var e=$(this),s=e.data(),i=e.parent(),n=i.parents("form"),a=i.data(),r=void 0!==a.comboboxPrefixClass?a.comboboxPrefixClass:"",l=i.find(".js-suggest div"),u=i.find(".js-suggestion-text"),d=void 0!==s.suggestionSingle?s.suggestionSingle:"There is ",c=void 0!==s.suggestionPlural?s.suggestionPlural:"There are ",b=void 0!==s.suggestionWord?s.suggestionWord:"suggestion",f=void 0!==s.suggestionWord?s.suggestionWordPlural:"suggestions",g=void 0!==s.comboboxMinLength?Math.abs(s.comboboxMinLength):0,p=void 0!==s.comboboxCaseSensitive?s.comboboxCaseSensitive:"no",v=void 0!==s.comboboxLimitNumberSuggestions?Math.abs(s.comboboxLimitNumberSuggestions):666,m=void 0!==s.comboboxSearchOption?s.comboboxSearchOption:"beginning",x=void 0!==s.comboboxSeeMoreText?s.comboboxSeeMoreText:"See more results…",y=e.attr("data-number"),h=e.val(),j="";if(13===t.keyCode)n.submit();else if(27!==t.keyCode){e.attr("data-lastval",h);var C=o[y].length,k=0,T=0;if(l.empty(),""!=h&&h.length>=g){for(;k<C;)T<v&&("containing"===m&&("yes"===p&&o[y][k].indexOf(h)>=0||"no"===p&&o[y][k].toUpperCase().indexOf(h.toUpperCase())>=0)||"beginning"===m&&("yes"===p&&o[y][k].substring(0,h.length)===h||"no"===p&&o[y][k].substring(0,h.length).toUpperCase()===h.toUpperCase()))&&(l.append('<div id="suggestion-'+y+"-"+T+'" class="js-suggestion '+r+'suggestion" tabindex="-1" role="option">'+o[y][k]+"</div>"),T++),k++;if(T>=v&&(l.append('<div id="suggestion-'+y+"-"+T+'" class="js-suggestion js-seemore '+r+'suggestion" tabindex="-1" role="option">'+x+"</div>"),T++),T>1&&(j=c+T+" "+f+"."),1===T&&(j=d+T+" "+b+"."),0===T&&(j=d+T+" "+b+"."),T>=0)if(j!=u.text()){var S=$("<p>").text(j);u.attr("aria-live","polite"),u.empty(),u.append(S)}}}}).on("click",function(t){var e=$(t.target),o=$(".js-suggestion-text:not(:empty)"),s=o.parents(".js-container"),i=s.find(".js-combobox"),n=s.find(".js-suggest div");e.is(".js-suggestion")||e.is(".js-combobox")||!o.length||(i.val(i.attr("data-lastval")),n.empty(),o.empty())}).on("keydown",".js-combobox",function(t){var e=$(this),o=e.parent(),s=o.find(".js-combobox"),i=o.find(".js-suggest div"),n=i.find(".js-suggestion"),a=o.find(".js-suggestion-text"),r=void 0===e.attr("data-combobox-notab-options"),l=n.first();(!t.shiftKey&&9==t.keyCode&&r||40==t.keyCode)&&n.length&&(s.val(l.html()),n.first().focus(),t.preventDefault()),(27==t.keyCode||!1===r&&9==t.keyCode)&&(s.val(s.attr("data-lastval")),i.empty(),a.empty(),27==t.keyCode&&(t.preventDefault(),setTimeout(function(){s.focus()},300)))}).on("keydown",".js-suggestion",function(t){var e=$(this),o=e.parents(".js-container"),i=o.find(".js-combobox"),n=void 0===i.attr("data-combobox-notab-options"),a=o.find(".js-suggest div"),r=o.find(".js-suggestion-text"),l=e.next(),u=e.prev();if((27==t.keyCode||!1===n&&9==t.keyCode)&&(27==t.keyCode&&(i.val(i.attr("data-lastval")),a.empty(),r.empty(),setTimeout(function(){i.focus()},300),t.preventDefault()),!1===n&&9==t.keyCode&&(a.empty(),r.empty(),i.focus())),13!=t.keyCode&&32!=t.keyCode||(e.hasClass("js-seemore")?(i.val(i.attr("data-lastval")),a.empty(),r.empty(),setTimeout(function(){i.focus()},300),setTimeout(function(){s()},301),t.preventDefault()):(i.val(e.html()),i.attr("data-lastval",e.html()),a.empty(),r.empty(),setTimeout(function(){i.focus()},300),t.preventDefault())),!t.shiftKey&&9==t.keyCode&&n||40==t.keyCode){if(l.length)i.val(l.html()),l.focus();else if(i.val(i.attr("data-lastval")),t.shiftKey||9!=t.keyCode)setTimeout(function(){i.focus()},300);else{var d=jQuery.Event("keydown");d.which=27,d.keyCode=27,e.trigger(d)}t.preventDefault()}(t.shiftKey&&9==t.keyCode&&n||38==t.keyCode)&&(u.length?(i.val(u.html()),u.focus()):i.val(i.attr("data-lastval")).focus(),t.preventDefault())}).on("click",".js-clear-button",function(){var t=$(this).parent(),e=t.find(".js-combobox"),o=t.find(".js-suggest div"),s=t.find(".js-suggestion-text");o.empty(),s.empty(),e.val(""),e.attr("data-lastval","")}).on("click",".js-suggestion",function(){var t=$(this),e=t.html(),o=t.parents(".js-container"),i=o.find(".js-combobox"),n=o.find(".js-suggest div"),a=o.find(".js-suggestion-text");t.hasClass("js-seemore")?(n.empty(),a.empty(),i.focus(),s()):(i.val(e).focus(),n.empty(),a.empty())}))})}});
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Coding Style introduced by
Consider using undefined instead of void(0). It is equivalent and more straightforward to read.
Loading history...
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
Complexity Coding Style introduced by
You seem to be assigning a new value to the loop variable k here. Please check if this was indeed your intention. Even if it was, consider using another kind of loop instead.
Loading history...
Complexity Coding Style introduced by
You seem to be assigning a new value to the loop variable T here. Please check if this was indeed your intention. Even if it was, consider using another kind of loop instead.
Loading history...
Unused Code introduced by
The parameter t is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...