Changeset 925805
- Timestamp:
- 06/03/2014 05:30:44 PM (12 years ago)
- Location:
- social-exchange-plugin/trunk/js
- Files:
-
- 2 edited
-
sxlist.js (modified) (1 diff)
-
sxscripts.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
social-exchange-plugin/trunk/js/sxlist.js
r925284 r925805 1 jQuery(document).ready(function(){ var ids = []; jQuery(".sx-activate-campaign-list ").each(function(){ ids.push(jQuery(this).val()); }); jQuery.ajax({ url:ajaxurl, data:{action:"sx_get_posts_data",ids:ids}, type:"POST", dataType:"json", success:function(r){ jQuery.each(r,function(k,v){ jQuery("#sxsd_"+v.id).text(v.done); jQuery("#sxsn_"+v.id).val(v.likes); jQuery("#sxlndw_"+v.id).text(v.likes); var ftitle = ''; var stitle = ''; if(v.active == 'yes'){ ftitle = ' title= "Campaign is running" '; var fclass = 'sx-pause-inactive'; var sclass = 'sx-play-active'; jQuery("#sxlnw_"+v.id).hide(); jQuery("#sxlndw_"+v.id).show(); } else{ stitle = ' title= "Campaign is stopped" '; var fclass = 'sx-pause-active'; var sclass = 'sx-play-inactive'; jQuery("#sxlndw_"+v.id).hide(); jQuery("#sxlnw_"+v.id).show(); } jQuery("#sxen_"+v.id).html('<a class="campaign-btn '+fclass+'" '+ftitle+' data-value="yes" value=""></a> <a class="campaign-btn '+sclass+'" '+stitle+' data-value="no" value="" ></a>'); jQuery(".campaign-btn").on("click",sx_ToggleCampaign); }); jQuery(".sx-list-hide").fadeIn(); jQuery(".sx-cmp-btns").show(); } }); jQuery(".campaign-btn").on("click",sx_ToggleCampaign); function sx_ToggleCampaign(){ jQuery("#sx-error-label").hide(); if(jQuery(this).hasClass("sx-play-active") || jQuery(this).hasClass("sx-pause-active") ) return false; var parent = jQuery(this).parent().parent().parent(); var sn = parent.find('.sx-share-need-list').val(); var id = parent.find('.sx-activate-campaign-list').val(); var dn = parseInt(jQuery("#sxsd_"+id).text()); if(dn>=sn) { SXshowError("Maximum Shares value should be greater than your current number of Shares made"); return false; } var activate ; var ftitle = ''; var stitle = ''; if(jQuery(this).hasClass('sx-play-inactive')){ var activate = 'yes'; } if(jQuery(this).hasClass('sx-pause-inactive')){ var activate = 'no'; } var mainpage = "false"; if(jQuery(this).hasClass("main-page")) { mainpage = "true"; } if(activate == 'no'){ if (mainpage == "true"){ jQuery("#sxcmp").text("Campaign is paused"); } jQuery("#sxen_"+id).find(".sx-play-active").removeClass("sx-play-active").addClass("sx-play-inactive"); jQuery("#sxen_"+id).find(".sx-pause-inactive").removeClass("sx-pause-inactive").addClass("sx-pause-active"); jQuery("#sxlnw_"+id).show(); jQuery("#sxlndw_"+id).hide(); jQuery("#sxen_"+id).find(".sx-play-inactive").attr("title","Campaign is stopped"); jQuery("#sxen_"+id).find(".sx-pause-inactive").removeAttr("title" ); }else{ if (mainpage == "true"){ jQuery("#sxcmp").text("Campaign is running"); } jQuery("#sxlnw_"+id).hide(); jQuery("#sxlndw_"+id).show(); jQuery("#sxen_"+id).find(".sx-play-inactive").removeClass("sx-play-inactive").addClass("sx-play-active"); jQuery("#sxen_"+id).find(".sx-pause-active").removeClass("sx-pause-active").addClass("sx-pause-inactive"); jQuery("#sxen_"+id).find(".sx-play-inactive").removeAttr("title" ); jQuery("#sxen_"+id).find(".sx-pause-inactive").attr("title","Campaign is running"); } jQuery("#sxlndw_"+id).text(sn); parent.find(".sx-save-need-list").addClass("button-primary-disabled"); jQuery.ajax({ url:ajaxurl, data:{action:"sx_add_post_data",id:id,activate:activate,sn:sn,main:mainpage}, type:"POST", dataType:"json", success:function(r){ setTimeout(function() { parent.find(".sx-save-need-list").removeClass("button-primary-disabled") }, 100) ; } }); return false; }}) 1 jQuery(document).ready(function(){ var ids = []; jQuery(".sx-activate-campaign-list ").each(function(){ ids.push(jQuery(this).val()); }); jQuery.ajax({ url:ajaxurl, data:{action:"sx_get_posts_data",ids:ids}, type:"POST", dataType:"json", success:function(r){ jQuery.each(r,function(k,v){ jQuery("#sxsd_"+v.id).text(v.done); jQuery("#sxsn_"+v.id).val(v.likes); jQuery("#sxlndw_"+v.id).text(v.likes); var ftitle = ''; var stitle = ''; if(v.active == 'yes'){ ftitle = ' title= "Campaign is running" '; var fclass = 'sx-pause-inactive'; var sclass = 'sx-play-active'; jQuery("#sxlnw_"+v.id).hide(); jQuery("#sxlndw_"+v.id).show(); } else{ stitle = ' title= "Campaign is stopped" '; var fclass = 'sx-pause-active'; var sclass = 'sx-play-inactive'; jQuery("#sxlndw_"+v.id).hide(); jQuery("#sxlnw_"+v.id).show(); } jQuery("#sxen_"+v.id).html('<a class="campaign-btn '+fclass+'" '+ftitle+' data-value="yes" value=""></a> <a class="campaign-btn '+sclass+'" '+stitle+' data-value="no" value="" ></a>'); jQuery(".campaign-btn").on("click",sx_ToggleCampaign); }); jQuery(".sx-list-hide").fadeIn(); jQuery(".sx-cmp-btns").show(); } }); jQuery(".campaign-btn").on("click",sx_ToggleCampaign); function sx_ToggleCampaign(){ jQuery("#sx-error-label").hide(); if(jQuery(this).hasClass("sx-play-active") || jQuery(this).hasClass("sx-pause-active") ) return false; var parent = jQuery(this).parent().parent().parent(); var sn = parent.find('.sx-share-need-list').val(); var id = parent.find('.sx-activate-campaign-list').val(); var dn = parseInt(jQuery("#sxsd_"+id).text()); var activate; 2 var ftitle = ''; 3 var stitle = ''; 4 if (jQuery(this).hasClass('sx-play-inactive')) { 5 var activate = 'yes'; 6 } 7 if (jQuery(this).hasClass('sx-pause-inactive')) { 8 var activate = 'no'; 9 } 10 if (dn >= sn && activate == 'yes') { 11 SXshowError("Maximum Shares value should be greater than your current number of Shares made"); 12 return false; 13 } var mainpage = "false"; if(jQuery(this).hasClass("main-page")) { mainpage = "true"; } if(activate == 'no'){ if (mainpage == "true"){ jQuery("#sxcmp").text("Campaign is paused"); } jQuery("#sxen_"+id).find(".sx-play-active").removeClass("sx-play-active").addClass("sx-play-inactive"); jQuery("#sxen_"+id).find(".sx-pause-inactive").removeClass("sx-pause-inactive").addClass("sx-pause-active"); jQuery("#sxlnw_"+id).show(); jQuery("#sxlndw_"+id).hide(); jQuery("#sxen_"+id).find(".sx-play-inactive").attr("title","Campaign is stopped"); jQuery("#sxen_"+id).find(".sx-pause-inactive").removeAttr("title" ); }else{ if (mainpage == "true"){ jQuery("#sxcmp").text("Campaign is running"); } jQuery("#sxlnw_"+id).hide(); jQuery("#sxlndw_"+id).show(); jQuery("#sxen_"+id).find(".sx-play-inactive").removeClass("sx-play-inactive").addClass("sx-play-active"); jQuery("#sxen_"+id).find(".sx-pause-active").removeClass("sx-pause-active").addClass("sx-pause-inactive"); jQuery("#sxen_"+id).find(".sx-play-inactive").removeAttr("title" ); jQuery("#sxen_"+id).find(".sx-pause-inactive").attr("title","Campaign is running"); } jQuery("#sxlndw_"+id).text(sn); parent.find(".sx-save-need-list").addClass("button-primary-disabled"); jQuery.ajax({ url:ajaxurl, data:{action:"sx_add_post_data",id:id,activate:activate,sn:sn,main:mainpage}, type:"POST", dataType:"json", success:function(r){ setTimeout(function() { parent.find(".sx-save-need-list").removeClass("button-primary-disabled") }, 100) ; } }); return false; }}) -
social-exchange-plugin/trunk/js/sxscripts.js
r925284 r925805 1 function SXshowError(msg){ jQuery("#sx-error-label").html(msg).show();}function SXshowNotice(msg){ jQuery("#sx-error-label").hide(); jQuery("#sx-notice-label").html(msg+" <a class='button' id='sx-ok-notice'>OK</a>").show();}jQuery(document).ready(function(){ jQuery(".sx_need").on({ "mouseenter":function(){ if(jQuery(this).find(".sx-share-need-list").is(":visible")) { jQuery(this).find(".sx-save-need-list").show(); jQuery(this).find(".sx-share-need-list").width(jQuery(this).find(".sx-share-need-list").width() - jQuery(this).find(".sx-save-need-list").width()); } }, "mouseleave":function(){ if(jQuery(this).find(".sx-share-need-list").is(":visible")) { jQuery(this).find(".sx-save-need-list").hide(); jQuery(this).find(".sx-share-need-list").width(jQuery(this).find(".sx-share-need-list").width() +jQuery(this).find(".sx-save-need-list").width()); } } }); jQuery("#sx-ok-notice").on("click",function(){ jQuery(this).closest("form").submit(); }); jQuery(".post-page").bindFirst("click",function(){ var okn = true; var sn = jQuery('input[name="sx-post-likes"]').val(); var id = jQuery('#post_ID').val(); var dn = parseInt(jQuery("#sxsd_"+id).text()); if(jQuery("#hidden_post_status").val() != 'publish') { SXshowError("You can share only published posts"); return false; } if(document.URL.indexOf("http://localhost") > -1) { SXshowError("You can not share localhost posts"); return false; } if (dn>=sn) { SXshowError("Maximum Shares value should be greater than your current number of Shares made"); return false; } if(jQuery("#sample-permalink").text().indexOf("?") > -1) { SXshowNotice("Ugly permalinks like \""+jQuery("#sample-permalink").text()+"\" are not search engine friendly. Are you sure this is the final URL you will use for this post?"); okn = false; } if(jQuery(this).hasClass("sx-play-active") || jQuery(this).hasClass("sx-pause-active") ) return false; var value = jQuery(this).attr("data-value"); jQuery("#sx-post-active").val(value); if(okn){ jQuery(this).closest("form").submit(); } return false; });})1 function SXshowError(msg){ jQuery("#sx-error-label").html(msg).show();}function SXshowNotice(msg){ jQuery("#sx-error-label").hide(); jQuery("#sx-notice-label").html(msg+" <a class='button' id='sx-ok-notice'>OK</a>").show();}jQuery(document).ready(function(){ jQuery(".sx_need").on({ "mouseenter":function(){ if(jQuery(this).find(".sx-share-need-list").is(":visible")) { jQuery(this).find(".sx-save-need-list").show(); jQuery(this).find(".sx-share-need-list").width(jQuery(this).find(".sx-share-need-list").width() - jQuery(this).find(".sx-save-need-list").width()); } }, "mouseleave":function(){ if(jQuery(this).find(".sx-share-need-list").is(":visible")) { jQuery(this).find(".sx-save-need-list").hide(); jQuery(this).find(".sx-share-need-list").width(jQuery(this).find(".sx-share-need-list").width() +jQuery(this).find(".sx-save-need-list").width()); } } }); jQuery("#sx-ok-notice").on("click",function(){ jQuery(this).closest("form").submit(); }); jQuery(".post-page").bindFirst("click",function(){ var okn = true; var sn = jQuery('input[name="sx-post-likes"]').val(); var id = jQuery('#post_ID').val(); var dn = parseInt(jQuery("#sxsd_"+id).text()); if(jQuery("#hidden_post_status").val() != 'publish') { SXshowError("You can share only published posts"); return false; } if(document.URL.indexOf("http://localhost") > -1) { SXshowError("You can not share localhost posts"); return false; } if (dn >= sn && jQuery(this).hasClass("sx-play-inactive")) { SXshowError("Maximum Shares value should be greater than your current number of Shares made"); return false; } if(jQuery("#sample-permalink").text().indexOf("?") > -1) { SXshowNotice("Ugly permalinks like \""+jQuery("#sample-permalink").text()+"\" are not search engine friendly. Are you sure this is the final URL you will use for this post?"); okn = false; } if(jQuery(this).hasClass("sx-play-active") || jQuery(this).hasClass("sx-pause-active") ) return false; var value = jQuery(this).attr("data-value"); jQuery("#sx-post-active").val(value); if(okn){ jQuery(this).closest("form").submit(); } return false; });})
Note: See TracChangeset
for help on using the changeset viewer.