show rotator on button
This commit is contained in:
parent
a1b9f27545
commit
660a9cf285
1 changed files with 70 additions and 33 deletions
|
@ -765,12 +765,36 @@ function htmlToText(htmlString) {
|
|||
*/
|
||||
function doActivityItemAction(ident, verb, un) {
|
||||
_verb = un ? 'un' + verb : verb;
|
||||
$('#like-rotator-' + ident.toString()).show();
|
||||
var rot = $('<img id="waitfor-' + verb + '-' + ident.toString() + '">')
|
||||
.attr('src', 'images/rotator.gif')
|
||||
.addClass("fa");
|
||||
//$('#like-rotator-' + ident.toString()).show();
|
||||
if (verb.indexOf("announce") === 0 ) {
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "]").off('click');
|
||||
// $("button[id^=shareMenuOptions-" + ident.toString() + "] i:first-child").hide();
|
||||
$("button[id^=announce-" + ident.toString() + "]").off('click');
|
||||
// $("button[id^=announce-" + ident.toString() + "] i:first-child").hide();
|
||||
if ($('img[id^=waitfor-' + verb + "-" + ident.toString() + "]").length == 0) {
|
||||
rot.addClass("fa-share").appendTo($("button[id^=shareMenuOptions-" + ident.toString() + "] i:first-child" )).show();
|
||||
rot.removeClass("fa-share").addClass("fa-retweet").appendTo($("button[id^=announce-" + ident.toString() + "] i:first-child" )).show();
|
||||
} else {
|
||||
$('img[id^=waitfor-' + verb + "-" + ident.toString() + "]").show()
|
||||
}
|
||||
} else {
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "]").off('click');
|
||||
// $("button[id^=" + verb + "-" + ident.toString() + "] i:first-child").hide();
|
||||
if ($('#waitfor-' + verb + "-" + ident.toString()).length == 0) {
|
||||
rot.addClass("fa-thumbs-up").appendTo($("button[id^=" + verb + "-" + ident.toString() + "] i:first-child")).show();
|
||||
} else {
|
||||
$('img[id^=waitfor-' + verb + "-" + ident.toString() + "]").show()
|
||||
}
|
||||
}
|
||||
$.post('item/' + ident.toString() + '/activity/' + _verb)
|
||||
.success(
|
||||
function(data){
|
||||
//$('#like-rotator-' + ident.toString()).hide();
|
||||
$("img[id^=waitfor-" + verb + "-" + ident.toString() + "]").hide();
|
||||
if (data.status == "ok") {
|
||||
$('#like-rotator-' + ident.toString()).hide();
|
||||
if (verb.indexOf("announce") === 0 ) {
|
||||
if (data.verb == "un" + verb) {
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "]" )
|
||||
|
@ -787,6 +811,8 @@ function doActivityItemAction(ident, verb, un) {
|
|||
.addClass("active")
|
||||
.attr("onclick", "doActivityItemAction(" + ident +", '" + verb + "', " + true + ")").change();
|
||||
}
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "]").on('click');
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "] i:first-child").show();
|
||||
} else {
|
||||
if (data.verb == "un" + verb) {
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "]" )
|
||||
|
@ -797,15 +823,26 @@ function doActivityItemAction(ident, verb, un) {
|
|||
.addClass("active")
|
||||
.attr("onclick", "doActivityItemAction(" + ident +", '" + verb + "', " + true + ")").change();
|
||||
}
|
||||
// $("button[id^=" + verb + "-" + ident.toString() + "]" ).button('refresh');
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "]").on('click');
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "] i:first-child").show();
|
||||
}
|
||||
} else {
|
||||
$.jGrowl("No connection to host for " + verb, {sticky: false, theme: 'info', life: 5000});
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "]").on('click');
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "] i:first-child").show();
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "]").on('click');
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "] i:first-child").show();
|
||||
$.jGrowl(verb + " not successful", {sticky: false, theme: 'info', life: 5000});
|
||||
}
|
||||
})
|
||||
.error(
|
||||
function(data){
|
||||
$.jGrowl("Activity " + verb + "unsuccessful", {sticky: false, theme: 'info', life: 5000});
|
||||
//$('#like-rotator-' + ident.toString()).hide();
|
||||
$("img[id^=waitfor-" + verb + "-" + ident.toString() + "]").remove();
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "]").on('click');
|
||||
$("button[id^=shareMenuOptions-" + ident.toString() + "] i:first-child").show();
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "]").on('click');
|
||||
$("button[id^=" + verb + "-" + ident.toString() + "] i:first-child").show();
|
||||
$.jGrowl(verb + " not successful", {sticky: false, theme: 'info', life: 5000});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue