Skip to content

Commit

Permalink
new push link for note
Browse files Browse the repository at this point in the history
  • Loading branch information
Tran Chau committed Nov 29, 2024
1 parent 2e39c35 commit 9f80f3c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
32 changes: 25 additions & 7 deletions links/note-lib/script-note.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ function change_note_cat(ischange){
glb_link_note_current = main_key + user_ID;
getNoteListCategory();
}

var isFirstSetCatNote = true;
var isFirstSetDetailNote = true;
function getNoteListCategory() {
// console.log('note-list-cat')

Expand Down Expand Up @@ -187,14 +188,28 @@ function getNoteListCategory() {
index++;
}
if ($('#split-0 .list li').length > 0) {
const myTimeout = setTimeout(function(){
$('#split-0 .list li').eq(0).trigger('click');
}, 500);
if(isFirstSetCatNote == true){
var infoLink = getLinkHasUrl();

if(infoLink[1]){
$('.list-category-note li[data-id="'+infoLink[1]+'"]').trigger('click');
}else{
//trigger default check first
const myTimeout = setTimeout(function(){
$('#split-0 .list li').eq(0).trigger('click');
}, 500);
}
if(infoLink[2]){
idLastClickDetail= infoLink[2]
}
isFirstSetCatNote = false;
}


}
setTotalFooter1(Object.keys(newObjectSort).length);
focus_category_reload(last_select_note_cat);
last_select_note_cat = 0;
//focus_category_reload(last_select_note_cat);
//last_select_note_cat = 0;
});
}

Expand Down Expand Up @@ -690,11 +705,13 @@ function event1_delete() {
}

function event1_click(at) {
// console.log(at)

$('.list-history li').removeClass('active');

var id = at.getAttribute('data-id');
idCategory_selected = id;
//console.log(id)
buildLinkNote(id,"")
getNoteListPost(id);

// hideShowLoadingEditor(1);
Expand Down Expand Up @@ -836,6 +853,7 @@ var li2_index = 0;
function event2_click(at) {

var id = at.getAttribute('data-id');
buildLinkNote(idCategory_selected,id)

var listItem = $('li[data-id="'+id+'"]');
li2_index = $( "#split-1 .list li" ).index( listItem );
Expand Down
30 changes: 28 additions & 2 deletions links/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,34 @@ function showNeedEnterAfter5Minus(){

//try active last click
function tabClick() {
var tag = window.location.hash;
$('a[href="' + tag + '"]').click();
var listTag = getLinkHasUrl();
if(listTag[0]){
$('a[href="' + listTag[0] + '"]').click();
}
//if(listTag[0] == "#note"){
//var key1 = listTag[1];
//var key2 = listTag[2];
//console.log(key1)
//console.log(key2)
//}
}
function getLinkHasUrl(){
var tag = window.location.hash;
var listTag = tag.split('/');
return listTag;
}
function buildLinkNote(key1,key2){
var domainAndAt = window.location.origin + window.location.pathname;
var atHas = "#note";
if(key1){
atHas += '/'+key1;
}
if(key2){
atHas += '/'+key2;
}
var linkResult = domainAndAt+atHas;
//console.log(linkResult);
history.pushState(null, null, linkResult);
}

function addEventTodo(text, key) {
Expand Down

0 comments on commit 9f80f3c

Please sign in to comment.