diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-04-26 09:05:47 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-04-26 09:05:47 +0200 |
commit | 09666ae8e9d7195c4b839abd9b10ae23ff783558 (patch) | |
tree | c8947d413ed3b5258fe8e25b905d2cac98c034e0 /view | |
parent | 953d02e4b7c8ae7e1ccbecb37751936cd23710e0 (diff) | |
parent | fe724acc3b78af5ed86b4bf0ff58bdd9b56356e2 (diff) | |
download | volse-hubzilla-09666ae8e9d7195c4b839abd9b10ae23ff783558.tar.gz volse-hubzilla-09666ae8e9d7195c4b839abd9b10ae23ff783558.tar.bz2 volse-hubzilla-09666ae8e9d7195c4b839abd9b10ae23ff783558.zip |
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'view')
-rw-r--r-- | view/js/autocomplete.js | 30 | ||||
-rwxr-xr-x | view/tpl/jot-header.tpl | 23 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 4 |
3 files changed, 31 insertions, 26 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 76c3fb69e..0a440aa90 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -8,20 +8,20 @@ function contact_search(term, callback, backend_url, type, extra_channels, spine $(spinelement).show(); } // Check if there is a cached result that contains the same information we would get with a full server-side search - var bt = backend_url+type; - if(!(bt in contact_search.cache)) contact_search.cache[bt] = {}; +// var bt = backend_url+type; +// if(!(bt in contact_search.cache)) contact_search.cache[bt] = {}; - var lterm = term.toLowerCase(); // Ignore case - for(var t in contact_search.cache[bt]) { - if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results - $(spinelement).hide(); +// var lterm = term.toLowerCase(); // Ignore case +// for(var t in contact_search.cache[bt]) { +// if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results +// $(spinelement).hide(); // Filter old results locally - var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one - matching.unshift({taggable:false, text: term, replace: term}); - setTimeout(function() { callback(matching); } , 1); // Use "pseudo-thread" to avoid some problems - return; - } - } +// var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one +// matching.unshift({taggable:false, text: term, replace: term}); +// setTimeout(function() { callback(matching); } , 1); // Use "pseudo-thread" to avoid some problems +// return; +// } +// } var postdata = { start:0, @@ -41,9 +41,9 @@ function contact_search(term, callback, backend_url, type, extra_channels, spine success: function(data){ // Cache results if we got them all (more information would not improve results) // data.count represents the maximum number of items - if(data.items.length -1 < data.count) { - contact_search.cache[bt][lterm] = data.items; - } +// if(data.items.length -1 < data.count) { +// contact_search.cache[bt][lterm] = data.items; +// } var items = data.items.slice(0); items.unshift({taggable:false, text: term, replace: term}); callback(items); diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 991a4c8b1..df67e9b2d 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -568,11 +568,14 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del function postSaveChanges(action, type) { if({{$auto_save_draft}}) { + var doctype = $('#jot-webpage').val(); + var postid = '-' + doctype + '-' + $('#jot-postid').val(); + if(action != 'clean') { - localStorage.setItem("post_title", $("#jot-title").val()); - localStorage.setItem("post_body", $("#profile-jot-text").val()); + localStorage.setItem("post_title" + postid, $("#jot-title").val()); + localStorage.setItem("post_body" + postid, $("#profile-jot-text").val()); if($("#jot-category").length) - localStorage.setItem("post_category", $("#jot-category").val()); + localStorage.setItem("post_category + postid", $("#jot-category").val()); } if(action == 'start') { @@ -589,9 +592,9 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del if(action == 'clean') { clearTimeout(postSaveTimer); postSaveTimer = null; - localStorage.removeItem("post_title"); - localStorage.removeItem("post_body"); - localStorage.removeItem("post_category"); + localStorage.removeItem("post_title" + postid); + localStorage.removeItem("post_body" + postid); + localStorage.removeItem("post_category" + postid); } } @@ -602,9 +605,11 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del var cleaned = false; if({{$auto_save_draft}}) { - var postTitle = localStorage.getItem("post_title"); - var postBody = localStorage.getItem("post_body"); - var postCategory = (($("#jot-category").length) ? localStorage.getItem("post_category") : ''); + var doctype = $('#jot-webpage').val(); + var postid = '-' + doctype + '-' + $('#jot-postid').val(); + var postTitle = localStorage.getItem("post_title" + postid); + var postBody = localStorage.getItem("post_body" + postid); + var postCategory = (($("#jot-category").length) ? localStorage.getItem("post_category" + postid) : ''); var openEditor = false; if(postTitle) { diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index bc9339d4c..9aa330c40 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -21,8 +21,8 @@ <input type="hidden" name="media_str" id="jot-media" value="" /> <input type="hidden" name="source" id="jot-source" value="{{$source}}" /> <input type="hidden" name="coord" id="jot-coord" value="" /> - <input type="hidden" name="post_id" value="{{$post_id}}" /> - <input type="hidden" name="webpage" value="{{$webpage}}" /> + <input type="hidden" id="jot-postid" name="post_id" value="{{$post_id}}" /> + <input type="hidden" id="jot-webpage" name="webpage" value="{{$webpage}}" /> <input type="hidden" name="preview" id="jot-preview" value="0" /> <input type="hidden" id="jot-consensus" name="consensus" value="{{if $consensus}}{{$consensus}}{{else}}0{{/if}}" /> <input type="hidden" id="jot-nocomment" name="nocomment" value="{{if $nocomment}}{{$nocomment}}{{else}}0{{/if}}" /> |