From 5d270fbb54c679f8f41ae83a4b3e1f2f7962ecd5 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 30 Jan 2021 17:51:27 -0500 Subject: [PATCH] Rename dostar() to doStar() --- view/js/main.js | 19 ++++++++++++------- view/templates/wall_thread.tpl | 2 +- view/theme/frio/templates/search_item.tpl | 4 ++-- view/theme/frio/templates/wall_thread.tpl | 8 ++++---- view/theme/quattro/templates/photo_item.tpl | 4 ++-- view/theme/quattro/templates/search_item.tpl | 4 ++-- view/theme/quattro/templates/wall_thread.tpl | 4 ++-- view/theme/smoothly/templates/wall_thread.tpl | 2 +- view/theme/vier/templates/photo_item.tpl | 4 ++-- view/theme/vier/templates/search_item.tpl | 4 ++-- view/theme/vier/templates/wall_thread.tpl | 4 ++-- 11 files changed, 32 insertions(+), 27 deletions(-) diff --git a/view/js/main.js b/view/js/main.js index 4921ea94f..d1976fdaa 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -682,21 +682,26 @@ function dosubthread(ident) { liking = 1; } -function dostar(ident) { +function doStar(ident) { ident = ident.toString(); $('#like-rotator-' + ident).show(); - $.get('starred/' + ident, function(data) { - if (data.match(/1/)) { - $('#starred-' + ident).addClass('starred'); - $('#starred-' + ident).removeClass('unstarred'); + $.get('starred/' + ident) + .then(function(data) { + if (data.state === 1) { + $('#starred-' + ident) + .addClass('starred') + .removeClass('unstarred'); $('#star-' + ident).addClass('hidden'); $('#unstar-' + ident).removeClass('hidden'); } else { - $('#starred-' + ident).addClass('unstarred'); - $('#starred-' + ident).removeClass('starred'); + $('#starred-' + ident) + .addClass('unstarred') + .removeClass('starred'); $('#star-' + ident).removeClass('hidden'); $('#unstar-' + ident).addClass('hidden'); } + }) + .always(function () { $('#like-rotator-' + ident).hide(); }); } diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl index 7dcdb15a5..0d2561869 100644 --- a/view/templates/wall_thread.tpl +++ b/view/templates/wall_thread.tpl @@ -105,7 +105,7 @@ {{/if}} {{if $item.star}} - + {{/if}} {{if $item.tagger}} diff --git a/view/theme/frio/templates/search_item.tpl b/view/theme/frio/templates/search_item.tpl index 6e76f23d6..bcd957396 100644 --- a/view/theme/frio/templates/search_item.tpl +++ b/view/theme/frio/templates/search_item.tpl @@ -206,8 +206,8 @@ {{if $item.star}}
  • -  {{$item.star.do}} -  {{$item.star.undo}} +  {{$item.star.do}} +  {{$item.star.undo}}
  • {{/if}} diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index f632b0bba..34d2a7374 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -358,8 +358,8 @@ as the value of $top_child_total (this is done at the end of this file) {{if $item.star}}
  • -  {{$item.star.do}} -  {{$item.star.undo}} +  {{$item.star.do}} +  {{$item.star.undo}}
  • {{/if}} @@ -523,8 +523,8 @@ as the value of $top_child_total (this is done at the end of this file) {{if $item.star}}
  • -  {{$item.star.do}} -  {{$item.star.undo}} +  {{$item.star.do}} +  {{$item.star.undo}}
  • {{/if}} diff --git a/view/theme/quattro/templates/photo_item.tpl b/view/theme/quattro/templates/photo_item.tpl index 182607ab3..4a43d2cb8 100644 --- a/view/theme/quattro/templates/photo_item.tpl +++ b/view/theme/quattro/templates/photo_item.tpl @@ -33,8 +33,8 @@
    {{if $star}} - {{$star.do}} - {{$star.undo}} + {{$star.do}} + {{$star.undo}} {{$star.tagger}} {{/if}} diff --git a/view/theme/quattro/templates/search_item.tpl b/view/theme/quattro/templates/search_item.tpl index 70aa2ed86..3793cb103 100644 --- a/view/theme/quattro/templates/search_item.tpl +++ b/view/theme/quattro/templates/search_item.tpl @@ -52,8 +52,8 @@
    {{if $item.star}} - {{$item.star.do}} - {{$item.star.undo}} + {{$item.star.do}} + {{$item.star.undo}} {{$item.star.tagger}} {{/if}} diff --git a/view/theme/quattro/templates/wall_thread.tpl b/view/theme/quattro/templates/wall_thread.tpl index 671b7643f..e3ed4f26c 100644 --- a/view/theme/quattro/templates/wall_thread.tpl +++ b/view/theme/quattro/templates/wall_thread.tpl @@ -102,8 +102,8 @@ {{$item.pin.undo}} {{/if}} {{if $item.star}} - {{$item.star.do}} - {{$item.star.undo}} + {{$item.star.do}} + {{$item.star.undo}} {{/if}} {{if $item.ignore}} {{$item.ignore.do}} diff --git a/view/theme/smoothly/templates/wall_thread.tpl b/view/theme/smoothly/templates/wall_thread.tpl index 4f70ea6d5..53f918813 100644 --- a/view/theme/smoothly/templates/wall_thread.tpl +++ b/view/theme/smoothly/templates/wall_thread.tpl @@ -117,7 +117,7 @@ {{/if}} {{if $item.star}} - + {{/if}} {{if $item.tagger}} diff --git a/view/theme/vier/templates/photo_item.tpl b/view/theme/vier/templates/photo_item.tpl index aafadae91..069bd2229 100644 --- a/view/theme/vier/templates/photo_item.tpl +++ b/view/theme/vier/templates/photo_item.tpl @@ -40,8 +40,8 @@
    {{if $star}} - {{$star.do}} - {{$star.undo}} + {{$star.do}} + {{$star.undo}} {{$star.tagger}} {{/if}} diff --git a/view/theme/vier/templates/search_item.tpl b/view/theme/vier/templates/search_item.tpl index 7a4c332d0..063e0e943 100644 --- a/view/theme/vier/templates/search_item.tpl +++ b/view/theme/vier/templates/search_item.tpl @@ -57,8 +57,8 @@
    {{if $item.star}} - {{$item.star.do}} - {{$item.star.undo}} + {{$item.star.do}} + {{$item.star.undo}} {{$item.star.tagger}} {{/if}} diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index 1e4806c9e..73997e7c5 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -140,8 +140,8 @@ {{$item.pin.undo}} {{/if}} {{if $item.star}} - {{$item.star.do}} - {{$item.star.undo}} + {{$item.star.do}} + {{$item.star.undo}} {{/if}} {{if $item.ignore}} {{$item.ignore.do}}