Skip to content

Commit

Permalink
Changed the way we use the setTimeout function. Should fix #403 #491 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tidusjar committed Aug 24, 2016
1 parent f63d729 commit 9a31a51
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
12 changes: 9 additions & 3 deletions PlexRequests.UI/Content/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ $(function () {
if (searchTimer) {
clearTimeout(searchTimer);
}
searchTimer = setTimeout(movieSearch, 800);
searchTimer = setTimeout(function () {
movieSearch();
}.bind(this), 800);

});

Expand All @@ -75,7 +77,9 @@ $(function () {
if (searchTimer) {
clearTimeout(searchTimer);
}
searchTimer = setTimeout(tvSearch, 400);
searchTimer = setTimeout(function() {
tvSearch();
}.bind(this), 800);
});

// Click TV dropdown option
Expand Down Expand Up @@ -116,7 +120,9 @@ $(function () {
if (searchTimer) {
clearTimeout(searchTimer);
}
searchTimer = setTimeout(musicSearch, 400);
searchTimer = setTimeout(function () {
musicSearch();
}.bind(this), 800);

});

Expand Down
15 changes: 15 additions & 0 deletions PlexRequests.UI/Content/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@
return s;
}

Function.prototype.bind = function (parent) {
var f = this;
var args = [];

for (var a = 1; a < arguments.length; a++) {
args[args.length] = arguments[a];
}

var temp = function () {
return f.apply(parent, args);
}

return (temp);
}

$(function() {
$('[data-toggle="tooltip"]').tooltip();
});
Expand Down

0 comments on commit 9a31a51

Please sign in to comment.