nxs_jsPostToSNAP2

The NextScripts: Social Networks Auto-Poster nxs jsPostToSNAP2 function.

Description

nxs_jsPostToSNAP2(); 

Usage

  1. if ( !function_exists( 'nxs_jsPostToSNAP2' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/nxs_functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = nxs_jsPostToSNAP2(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/nxs_functions.php  
  1. if (!function_exists("nxs_jsPostToSNAP2")) { function nxs_jsPostToSNAP2() { global $nxs_snapAvNts, $nxs_snapThisPageUrl, $plgn_NS_SNAutoPoster, $nxs_plurl;  
  2. if (!isset($plgn_NS_SNAutoPoster)) return; $options = $plgn_NS_SNAutoPoster->nxs_options;  
  3. ?> 
  4.  
  5. <script type="text/javascript">  
  6.  
  7. jQuery(function() { 
  8. jQuery("form .categorydiv .selectit input:checkbox").click ( function() { var nxs_isLocked = jQuery('#nxsLockIt').val(); if (nxs_isLocked=='1') return;  
  9. var thVal = jQuery(this).val(); if (!jQuery(this).is(":checked")) return;  
  10.  
  11. var arr = [<?php if (!empty($options['exclCats'])) { $xarr = maybe_unserialize($options['exclCats']); if (is_array($xarr)) echo "'".implode("', '", $xarr)."'"; } ?>]; 
  12. if ( jQuery.inArray(thVal, arr)>-1) jQuery('.nxsGrpDoChb').removeAttr('checked'); else jQuery(".nxsGrpDoChb[title='def']").attr('checked', 'checked'); 
  13.  
  14. jQuery(".nxs_SC").each(function(index) { var cats = jQuery(this).val(); var catsA = cats.split(', '); uqID = jQuery(this).attr('id'); uqID = uqID.replace("nxs_SC_", "do", "gi"); 
  15. if (jQuery.inArray(thVal, catsA)>-1) jQuery('#'+uqID).attr('checked', 'checked') 
  16. // alert( uqID + "|" + catsA + "|" + thVal);  
  17. });  
  18.  
  19. jQuery(".nxs_TG").each(function(index) { var cats = jQuery(this).val(); var catsA = cats.split(', '); uqID = jQuery(this).attr('id'); uqID = uqID.replace("nxs_TG_", "do", "gi"); 
  20. if (jQuery.inArray(thVal, catsA)>-1) jQuery('#'+uqID).attr('checked', 'checked') 
  21. // alert( uqID + "|" + catsA + "|" + thVal);  
  22. });  
  23.  
  24. }); 
  25. }); 
  26.  
  27. function seFBA(pgID, fbAppID, fbAppSec) { var data = { pgID: pgID, action: 'nsAuthFBSv', _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()};  
  28. jQuery.post(ajaxurl, data, function(response) {  
  29. window.location = "https://www.facebook.com/dialog/oauth?client_id="+fbAppID+"&client_secret="+fbAppSec+"&scope=publish_stream, offline_access, read_stream, manage_pages&redirect_uri=<?php echo $nxs_snapThisPageUrl;?>"; 
  30. });  
  31. function doLic() { var lk = jQuery('#eLic').val(); jQuery.post(ajaxurl, {lk:lk, action: 'nxsDoLic', id: 0, _wpnonce: jQuery('input#doLic_wpnonce').val()}, function(j) {  
  32. if (jQuery.trim(j)=='OK') window.location = "<?php echo $nxs_snapThisPageUrl; ?>"; else alert('<?php _e('Wrong key, please contact support', 'social-networks-auto-poster-facebook-twitter-g'); ?>'); 
  33. }, "html") 
  34. function testPost(nt, nid) { jQuery(".blnkg").hide(); <?php foreach ($nxs_snapAvNts as $avNt) {?> 
  35. if (nt=='<?php echo $avNt['code']; ?>') {  
  36. var data = { action: 'rePostTo<?php echo $avNt['code']; ?>', id: 0, nid: nid, _wpnonce: jQuery('input#nxsSsPageWPN_wpnonce').val()}; callAjSNAP(data, '<?php echo $avNt['name']; ?>');  
  37. }<?php } ?> 
  38.  
  39. function nxs_doTabs() { 
  40. jQuery('#nxsAPIUpd').dblclick(function() { doLic(); }); 
  41. //When page loads... 
  42. jQuery(".nsx_tab_content").hide(); //Hide all content 
  43. jQuery("ul.nsx_tabs > li:first-child").addClass("active").show(); //Activate first tab 
  44. jQuery(".nsx_tab_container > .nsx_tab_content:first-child").show(); //Show first tab content 
  45.  
  46. //On Click Event 
  47. jQuery("ul.nsx_tabs li").click(function() { 
  48. jQuery(this).parent().children("li").removeClass("active"); //Remove any "active" class 
  49. jQuery(this).addClass("active"); //Add "active" class to selected tab 
  50. jQuery(this).parent().parent().children(".nsx_tab_container").children(".nsx_tab_content").hide(); //Hide all tab content  
  51. var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content 
  52. jQuery(activeTab).show(); //Fade in the active ID content 
  53. return false; 
  54. }); 
  55.  
  56.  
  57. function nxs_doTabsInd(iid) {  
  58. //When page loads... 
  59. jQuery(iid+" .nsx_tab_content").hide(); //Hide all content 
  60. jQuery(iid+" ul.nsx_tabs > li:first-child").addClass("active").show(); //Activate first tab 
  61. jQuery(iid+" .nsx_tab_container > .nsx_tab_content:first-child").show(); //Show first tab content 
  62.  
  63. //On Click Event 
  64. jQuery(iid+" ul.nsx_tabs li").click(function() { 
  65. jQuery(this).parent().children("li").removeClass("active"); //Remove any "active" class 
  66. jQuery(this).addClass("active"); //Add "active" class to selected tab 
  67. jQuery(this).parent().parent().children(".nsx_tab_container").children(".nsx_tab_content").hide(); //Hide all tab content  
  68. var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content 
  69. jQuery(activeTab).show(); //Fade in the active ID content 
  70. return false; 
  71. }); 
  72.  
  73.  
  74. function nxs_in_array(needle, haystack) { for(var i in haystack) { if(haystack[i] == needle) return true;} return false; } 
  75.  
  76.  
  77.  
  78. jQuery(document).ready(function() { nxs_doTabs(); 
  79. //## Check for excluded Tags  
  80. var nxs_curTagsValue = []; jQuery('.the-tags').each(function() {if (jQuery(this).val()!='') nxs_curTagsValue[jQuery(this).attr('id')] = jQuery(this).val(); }); 
  81. jQuery(function () { setTimeout(nxs_checkTagsChangesX, 50); }); 
  82.  
  83. function nxs_checkTagsChangesX() { var isChanged = false; var nxs_isLocked = jQuery('#nxsLockIt').val(); if (nxs_isLocked=='1') return; 
  84. jQuery('.the-tags').each(function() {  
  85. currentValue = jQuery( this ).val(); currID = jQuery(this).attr('id'); // console.log( currID );  
  86. if ((currentValue) && currentValue != nxs_curTagsValue[currID] && currentValue != '') isChanged = true; 
  87. });  
  88. if (isChanged) { //## Changed 
  89. jQuery('.the-tags').each(function() { if (jQuery(this).val()!='') nxs_curTagsValue[jQuery(this).attr('id')] = jQuery(this).val(); }); 
  90. var nxs_curTagsValueX = ''; var tValX = []; 
  91. jQuery('.the-tags').each(function() {  
  92. var tVals = jQuery( this ).val().toLowerCase().split(", "); var tID = jQuery( this ).attr('id').replace("tax-input-", "");  
  93. for(var ii in tVals) tValX.push(tID+"|"+jQuery.trim(tVals[ii]));  
  94. }); // console.log( tValX ); 
  95. jQuery(".nxs_TG").each(function(index) { var cats = jQuery(this).val(); var catsA = cats.split(', '); uqID = jQuery(this).attr('id'); uqID = uqID.replace("nxs_TG_", "do", "gi"); 
  96. // console.log( uqID ); console.log( JSON.stringify( catsA ) ); 
  97. for(var ii in catsA) { var tgVal = jQuery.trim(catsA[ii]).toLowerCase(); 
  98. if (tgVal.indexOf("|")<1 && tgVal!="") tgVal = "post_tag|"+tgVal; 
  99. if (tgVal!="" && jQuery.inArray(tgVal, tValX)>-1) { jQuery('#'+uqID).attr('checked', 'checked'); }  
  100. }  
  101. }); 
  102. } setTimeout(nxs_checkTagsChangesX, 50); 
  103.  
  104. }); 
  105. </script> 
  106.  
  107. <style type="text/css"> 
  108. .NXSButton { background-color:#89c403; 
  109. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #89c403), color-stop(1, #77a809) ); 
  110. background:-moz-linear-gradient( center top, #89c403 5%, #77a809 100% ); 
  111. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#89c403', endColorstr='#77a809');  
  112. -moz-border-radius:4px; -webkit-border-radius:4px; border-radius:4px; border:1px solid #74b807; display:inline-block; color:#ffffff; 
  113. font-family:Trebuchet MS; font-size:12px; font-weight:bold; padding:4px 5px; text-decoration:none; text-shadow:1px 1px 0px #528009; 
  114. }.NXSButton:hover {color:#ffffff; background-color:#77a809; 
  115. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #77a809), color-stop(1, #89c403) ); 
  116. background:-moz-linear-gradient( center top, #77a809 5%, #89c403 100% ); 
  117. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77a809', endColorstr='#89c403');  
  118. }.NXSButton:active {color:#ffffff; position:relative; top:1px;}.NXSButton:focus {color:#ffffff; position:relative; top:1px;} .nsBigText{font-size: 14px; color: #585858; font-weight: bold; display: inline;} 
  119. .NXSButtonB { background-color:#038bc4; 
  120. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #038bc4), color-stop(1, #096aa8) ); 
  121. background:-moz-linear-gradient( center top, #038bc4 5%, #096aa8 100% ); 
  122. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#038bc4', endColorstr='#096aa8');  
  123. -moz-border-radius:4px; -webkit-border-radius:4px; border-radius:4px; border:1px solid #077cb8; display:inline-block; color:#ffffff; 
  124. font-family:Trebuchet MS; font-size:12px; font-weight:bold; padding:4px 5px; text-decoration:none; text-shadow:1px 1px 0px #095d80; 
  125. }.NXSButtonB:hover {color:#ffffff; background-color:#096aa8; 
  126. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #096aa8), color-stop(1, #038bc4) ); 
  127. background:-moz-linear-gradient( center top, #096aa8 5%, #038bc4 100% ); 
  128. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#096aa8', endColorstr='#038bc4');  
  129. }.NXSButtonB:active {color:#ffffff; position:relative; top:1px;}.NXSButton:focus {color:#ffffff; position:relative; top:1px;} .nsBigText{font-size: 14px; color: #585858; font-weight: bold; display: inline;} 
  130. #nxs_ntType {width: 150px;} 
  131. #nsx_addNT {width: 600px;} 
  132. .nxsInfoMsg{ margin: 1px auto; padding: 3px 10px 3px 5px; border: 1px solid #ffea90; background-color: #fdfae4; display: inline; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } 
  133. .blnkg{text-decoration:blink; font-size: 17px; color: #0CB107; font-weight: bold; display: inline;} 
  134.  
  135. div.popShAtt { display: none; position: absolute; width: 600px; padding: 10px; background: #eeeeee; color: #000000; border: 1px solid #1a1a1a; font-size: 90%; } 
  136. .underdash {border-bottom: 1px #21759B dashed; text-decoration:none;} 
  137. .underdash a:hover {border-bottom: 1px #21759B dashed} 
  138.  
  139. .nxsTHRow {vertical-align:top; padding-top:6px; text-align:right; width:80px; padding-right:10px;} 
  140.  
  141. ul.nsx_tabs {margin: 0;padding: 0; margin-top:5px;float: left;list-style: none;height: 32px;border-bottom: 1px solid #999;border-left: 1px solid #999;width: 99%;} 
  142. ul.nsx_tabs li {float: left;margin: 0;padding: 0;height: 31px;line-height: 31px;border: 1px solid #999;border-left: none;margin-bottom: -1px;overflow: hidden;position: relative;background: #e0e0e0;} 
  143. ul.nsx_tabs li a {text-decoration: none;color: #000; display: block; font-size: 1.2em; padding: 0 20px; border: 1px solid #fff; outline: none;} 
  144. ul.nsx_tabs li a:hover { background: #ccc;} 
  145. html ul.nsx_tabs li.active, html ul.nsx_tabs li.active a:hover { background: #fff; border-bottom: 1px solid #fff; } 
  146. .nsx_tab_container {border: 1px solid #999; border-top: none; overflow: hidden; clear: both; float: left; width: 99%; background: #fff;} 
  147. .nsx_tab_content {padding: 10px;} 
  148.  
  149. .nxs_tls_cpt{width:100%; padding-bottom: 5px; padding-top: 10px;font-size: 16px; font-weight: bold;} 
  150. .nxs_tls_bd{width:100%; padding-left: 10px; padding-bottom: 10px;} 
  151. .nxs_tls_sbInfo{font-style: italic; padding-bottom: 10px; padding-top: 2px;} 
  152. .nxs_tls_sbInfo2{font-style: italic; padding-left: 10px; padding-bottom: 5px; line-height: 10px; font-size: 11px;} 
  153. .nxs_tls_lbl{width:100%;padding-top:7px;padding-bottom:1px;} 
  154. .nxsInstrSpan{ font-size: 11px; } 
  155.  
  156.  
  157. .subDiv{margin-left: 15px;} 
  158. .nxs_hili {color:#008000;} 
  159. .clNewNTSets{width: 800px;} 
  160. .nxclear {clear: both;} 
  161.  
  162. .nxs_icon16 { font-size: 14px; line-height: 18px; 
  163. background-position: 3px 50% !important; 
  164. background-repeat: no-repeat !important; 
  165. display: inline-block; 
  166. padding: 1px 0 1px 23px !important; 
  167.  
  168. .nxs_box{border-color: #DFDFDF; border-radius: 3px 3px 3px 3px; box-shadow: 0 1px 0 #FFFFFF inset; border-style: solid; border-width: 1px; line-height: 1; margin-bottom: 10px; padding: 0; /* max-width: 1080px; */} 
  169. .nxs_box_header{border-bottom-color: #DFDFDF; box-shadow: 0 1px 0 #FFFFFF; text-shadow: 0 1px 0 #FFFFFF;font-size: 15px;font-weight: normal;line-height: 1;margin: 0;padding: 6px; 
  170. background:#f1f1f1;background-image:-webkit-gradient(linear, left bottom, left top, from(#ececec), to(#f9f9f9));background-image:-webkit-linear-gradient(bottom, #ececec, #f9f9f9);background-image:-moz-linear-gradient(bottom, #ececec, #f9f9f9);background-image:-o-linear-gradient(bottom, #ececec, #f9f9f9);background-image:linear-gradient(to top, #ececec, #f9f9f9) 
  171. -moz-user-select: none;border-bottom-style: solid;border-bottom-width: 1px;} 
  172. .nxs_box_inside{line-height: 1.4em; padding: 10px;} 
  173. .nxs_box_inside input[type=text]{ padding: 5px; height: 24px; border: 1px solid #ACACAC;} 
  174. .nxs_box_inside .insOneDiv, #nsx_addNT .insOneDiv{max-width: 1020px; background-color: #f8f9f9; background-repeat: no-repeat; margin: 10px; border: 1px solid #808080; padding: 10px; display:none; overflow: hidden;} 
  175. .nxs_box_inside .itemDiv {margin:5px;margin-left:10px;} 
  176. .nxs_box_header h3 {font-size: 14px; margin-bottom: 2px; margin-top: 2px;} 
  177. .nxs_newLabel {font-size: 11px; color:red; padding-left: 5px; padding-right: 5px;} 
  178.  
  179. .nxs_prevImagesDiv {border:1px solid #0f3c6d; width:110px; height:110px; margin:3px; padding:3px; text-align:center; float:left; position: relative;} 
  180. .nxs_prevImages {padding:1px; max-height:100px; max-width:100px;} 
  181. .nxs_chImg_selDiv {border:1px solid #800000;} 
  182. .nxs_chImg_selImg {border:4px solid #800000;} 
  183. .nxs_checkIcon{position: absolute;} 
  184.  
  185. .nxs_checkIcon{display:none; height:24px;width:24px;position:absolute;top:-7px;right:-7px;outline:0;border:1px solid #fff;border-radius:3px;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.4);background:#800000;background-image:-webkit-gradient(linear, left top, left bottom, from(#800000), to(#570000));background-image:-webkit-linear-gradient(top, #800000, #570000);background-image:-moz-linear-gradient(top, #800000, #570000);background-image:-o-linear-gradient(top, #800000, #570000);background-image:linear-gradient(to bottom, #800000, #570000)} 
  186. .nxs_checkIcon{ top:-5px; right: -3px; width: 15px; height: 15px; box-shadow:0 0 0 1px #800000;background:#800000;background-image:-webkit-gradient(linear, left top, left bottom, from(#800000), to(#570000));background-image:-webkit-linear-gradient(top, #800000, #570000);background-image:-moz-linear-gradient(top, #800000, #570000);background-image:-o-linear-gradient(top, #800000, #570000);background-image:linear-gradient(to bottom, #800000, #570000)} 
  187. .nxs_checkIcon div{background-position:-21px 0; width: 15px; height: 15px;} 
  188. /* #nxsDivWrap .postbox .inside {overflow: hidden;} */ 
  189. #nxsDivWrap .postbox .description {vertical-align: middle; color: #ACACAC;}  
  190.  
  191. .submitX {padding-top: 7px; padding-bottom: 5px;} 
  192.  
  193. .nxs_txtIcon { margin: 0px; padding-left: 20px; background-repeat: no-repeat;} .nxs_ti_gp {background-image: url('<?php echo $nxs_plurl; ?>img/gp16.png');}  
  194. .nxs_ti_li {background-image: url('<?php echo $nxs_plurl; ?>img/li16.png');} .nxs_ti_rd {background-image: url('<?php echo $nxs_plurl; ?>img/rd16.png');}  
  195. .nxs_ti_fp {background-image: url('<?php echo $nxs_plurl; ?>img/fp16.png');} .nxs_ti_yt {background-image: url('<?php echo $nxs_plurl; ?>img/yt16.png');}  
  196. .nxs_ti_bg {background-image: url('<?php echo $nxs_plurl; ?>img/bg16.png');} .nxs_ti_pn {background-image: url('<?php echo $nxs_plurl; ?>img/pn16.png');}  
  197.  
  198. input[readonly]{ background-color:white; }  
  199. .nxs-selz-dropwodn {max-width: 200px;} 
  200. </style> 
  201. <?php }}