From df734b0ba384b4a5844e6528a0cac9dc6540b8b7 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 2 Nov 2021 06:05:56 -0400 Subject: [PATCH] fix multi-page search ability --- globals/config.php | 1 + globals/functions.php | 4 ++-- html/MCP/asset-management.php | 2 +- html/MCP/chat-logs/index.php | 2 +- html/alphaland/js/utilities.js | 17 +++++++++-------- html/avatar/index.php | 14 +++++--------- html/catalog/index.php | 7 +++++-- html/games/index.php | 2 +- html/games/pbs/config.php | 6 +++--- html/games/view.php | 2 +- html/groups/config.php | 4 ++-- html/groups/index.php | 4 ++-- html/groups/search.php | 2 +- html/home/index.php | 2 +- html/profile/view.php | 6 +++--- html/users/index.php | 2 +- 16 files changed, 39 insertions(+), 38 deletions(-) diff --git a/globals/config.php b/globals/config.php index cb71217..0a43d83 100644 --- a/globals/config.php +++ b/globals/config.php @@ -24,6 +24,7 @@ try $pdo = new PDO("mysql:host=localhost;dbname=alphalanddatabase", "aa9205c5b776b2368833bec1e8b34e1c", "68adae776e087fb1b34baf439710cf94", $pdoOptions); //general vars + $jsversion = "3.04"; //update this after updating JS, this will re-cache the latest js for users $cssversion = "3.02"; //update this after updating CSS, this will re-cache the latest css for users $siteName = "Alphaland"; //site name diff --git a/globals/functions.php b/globals/functions.php index 9386f49..7e7dc14 100644 --- a/globals/functions.php +++ b/globals/functions.php @@ -6565,8 +6565,8 @@ function getCSS($studio=false) - - '; //alphaland utilities js + + '; //alphaland utilities js } //end theme stuff diff --git a/html/MCP/asset-management.php b/html/MCP/asset-management.php index c71fe6e..8bd6da5 100644 --- a/html/MCP/asset-management.php +++ b/html/MCP/asset-management.php @@ -94,7 +94,7 @@ function assetPage(num, keyword = "") html +=''; html +=''; - multiPageHelper("assetPage", "https://www.alphaland.cc/MCP/pendingassets", "https://api.alphaland.cc/logo", "#assets-container", "#page-buttons", html, num, 10, "", "No pending assets"); + multiPageHelper("assetPage", [], "https://www.alphaland.cc/MCP/pendingassets", "https://api.alphaland.cc/logo", "#assets-container", "#page-buttons", html, num, 10, "", "No pending assets"); } assetPage(currentPage); diff --git a/html/MCP/chat-logs/index.php b/html/MCP/chat-logs/index.php index 5cc4a20..5a02ced 100644 --- a/html/MCP/chat-logs/index.php +++ b/html/MCP/chat-logs/index.php @@ -95,7 +95,7 @@ function logsPage(num) html+= ''; html+= ''; - multiPageHelper("logsPage", "https://www.alphaland.cc/MCP/chat-logs/loggedChats", "https://api.alphaland.cc/logo", "#message-container", "#page-buttons", html, num, 40, searchquery, "No Results", "&username="+usernamequery); + multiPageHelper("logsPage", [], "https://www.alphaland.cc/MCP/chat-logs/loggedChats", "https://api.alphaland.cc/logo", "#message-container", "#page-buttons", html, num, 40, searchquery, "No Results", "&username="+usernamequery); } logsPage(1); diff --git a/html/alphaland/js/utilities.js b/html/alphaland/js/utilities.js index 5cc9762..e843957 100644 --- a/html/alphaland/js/utilities.js +++ b/html/alphaland/js/utilities.js @@ -1,8 +1,9 @@ -function parseHtml(a,b,c,n,k){k=void 0===k?!1:k;for(var l="",f,m=0;m'+('')+"",$(c).html(b));getJSONCDS(a+"?limit="+l+"&page="+k+"&keyword="+f+d).done(function(a){$(c).html(parseHtml(n,l,a,m))})} -function multiPageHelper(a,b,c,n,k,l,f,m,d,g,e){e=void 0===e?"":e;""!==c&&(c='
'+('')+"
",$(n).html(c));$(k).html("");getJSONCDS(b+"?limit="+m+"&page="+f+"&keyword="+d+e).done(function(e){var b=!1,c="",d=e.pageCount,m=e.pageResults,h=f+1,q=f-1;var r=f+3;h>d&&(h=d);0==q&&(q=1);1d?(b=1,r=d):q==f-1?(b=f>=d-2?d-3:f-1,--r):b=f;c+=''; -c+='';for(i=b;i<=r;i++)i<=d&&(c+='");c+='';c+=''}$(n).html(parseHtml(l,m,e,g));$(k).html(c)})} -var Comments=function(a,b,c,n,k,l,f,m,d){this.assetid=a;this.commentsid=b;this.commentscontainer=c;this.buttonscontainer=n;this.successid=k;this.errorid=l;this.inputid=f;this.messageDelay=m;this.newObject=d;var g=this;getJSONCDS("https://api.alphaland.cc/game/info?id="+this.assetid).done(function(a){a.CommentsEnabled&&($(g.commentsid).show(),g.commentsPage())})}; -Comments.prototype.commentsPage=function(a){multiPageHelper(this.newObject+".commentsPage","https://api.alphaland.cc/comments/","https://api.alphaland.cc/logo",this.commentscontainer,this.buttonscontainer,'
Comment by {username} : {date}

{comment}

', -void 0===a?1:a,10,"","No comments","&assetId="+this.assetid)};Comments.prototype.submitComment=function(a){var b=this;postJSONCDS("https://api.alphaland.cc/comments/newcomment?assetId="+this.assetid,JSON.stringify({comment:a})).done(function(a){a=a.alert;var c=b.errorid;"Comment Placed"==a&&(c=b.successid,$(b.inputid).val(""),b.commentsPage());$(c).text(a);$(c).show();window.scrollTo({top:0,behavior:"smooth"});setTimeout(function(){$(c).hide()},b.messageDelay)})}; +var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b'),$(c).html(b));getJSONCDS(a+"?limit="+l+"&page="+p+"&keyword="+m+n).done(function(g){$(c).html(parseHtml(f,l,g,d))})} +function multiPageHelper(a,b,c,f,p,l,m,d,n,g,e,h){h=void 0===h?"":h;""!==f&&(f='
'),$(p).html(f));var k="";b&&b.constructor===Array&&(k=parseArrayArgs(b));$(l).html("");getJSONCDS(c+"?limit="+n+"&page="+d+"&keyword="+g+h).done(function(u){var r=!1,t="",q=u.pageCount,y=u.pageResults,w=d+1,v=d-1;var x=d+3;w>q&&(w=q);0==v&&(v=1);1q?(r=1,x=q):v==d-1?(r=d>=q-2?q-3:d-1,--x):r=d;t+='';t+='';for(i=r;i<=x;i++)i<=q&&(t+='");t+='';t+=''}$(p).html(parseHtml(m, +y,u,e));$(l).html(t)})}var Comments=function(a,b,c,f,p,l,m,d,n){this.assetid=a;this.commentsid=b;this.commentscontainer=c;this.buttonscontainer=f;this.successid=p;this.errorid=l;this.inputid=m;this.messageDelay=d;this.newObject=n;var g=this;getJSONCDS("https://api.alphaland.cc/game/info?id="+this.assetid).done(function(e){e.CommentsEnabled&&($(g.commentsid).show(),g.commentsPage())})}; +Comments.prototype.commentsPage=function(a){multiPageHelper(this.newObject+".commentsPage",[],"https://api.alphaland.cc/comments/","https://api.alphaland.cc/logo",this.commentscontainer,this.buttonscontainer,'
Comment by {username} : {date}

{comment}

', +void 0===a?1:a,10,"","No comments","&assetId="+this.assetid)};Comments.prototype.submitComment=function(a){var b=this;postJSONCDS("https://api.alphaland.cc/comments/newcomment?assetId="+this.assetid,JSON.stringify({comment:a})).done(function(c){c=c.alert;var f=b.errorid;"Comment Placed"==c&&(f=b.successid,$(b.inputid).val(""),b.commentsPage());$(f).text(c);$(f).show();window.scrollTo({top:0,behavior:"smooth"});setTimeout(function(){$(f).hide()},b.messageDelay)})}; \ No newline at end of file diff --git a/html/avatar/index.php b/html/avatar/index.php index 62711c5..82c5639 100644 --- a/html/avatar/index.php +++ b/html/avatar/index.php @@ -385,11 +385,7 @@ $body = ' avatarChange("https://api.alphaland.cc/user/avatar/assets/remove?assetId=" + assetId) } - function inventoryPageSearch(query) - { - getInventoryPage(assetTypeId, 1, 8, query) - } - function inventoryPage(page, assettype) + function inventoryPage(page, assettype, keyword) { if (assettype) { @@ -400,7 +396,7 @@ $body = ' $("#search_bar").show(); $("#create-outfit-button").hide(); $("#outfitsbutton").removeClass("active"); - getInventoryPage(assetTypeId, page, 8); + getInventoryPage(assetTypeId, page, 8, keyword); } function getInventoryPage(assettype, page, limit, keyword="") { @@ -411,7 +407,7 @@ $body = ' html += ""; html += ""; - multiPageHelper("inventoryPage", "https://api.alphaland.cc/users/profile/inventory", "https://api.alphaland.cc/logo", "#itemsDiv", "#page-buttons", html, page, limit, keyword, "You don\'t own any items of this type", "&assetTypeId="+assettype); + multiPageHelper("inventoryPage", [assettype,keyword], "https://api.alphaland.cc/users/profile/inventory", "https://api.alphaland.cc/logo", "#itemsDiv", "#page-buttons", html, page, limit, keyword, "You don\'t own any items of this type", "&assetTypeId="+assettype); } $(".headshot_checkbox_check").click(function() { @@ -582,7 +578,7 @@ $body = ' html += ""; html += ""; - multiPageHelper("outfitPage", "https://api.alphaland.cc/users/profile/outfits", "https://api.alphaland.cc/logo", "#itemsDiv", "#page-buttons", html, page, limit, "", "You don\'t have any outfits", "&assetTypeId="); + multiPageHelper("outfitPage", [], "https://api.alphaland.cc/users/profile/outfits", "https://api.alphaland.cc/logo", "#itemsDiv", "#page-buttons", html, page, limit, "", "You don\'t have any outfits", "&assetTypeId="); } @@ -601,7 +597,7 @@ $body = ' $("#keyword_input").keypress(function(event) { if (event.keyCode == 13 || event.which == 13) { - inventoryPageSearch($("#keyword_input").val()) + inventoryPage(1, assetTypeId, $("#keyword_input").val()) } }); getWearingItems() diff --git a/html/catalog/index.php b/html/catalog/index.php index 4eda3f0..99f79a4 100644 --- a/html/catalog/index.php +++ b/html/catalog/index.php @@ -102,6 +102,8 @@ $body = <<