1/* 2 * 3 * Javascript support for Thank You Counter Button WordPress plugin 4 * 5 */ 6 7function thankYouButtonRemoveSettingsShortcuts() { 8 9 // Update the option 10 jQuery.ajax({ 11 type: "POST", 12 url: ThanksSettings.ajax_url, 13 data: { 14 post_id: -1, 15 action: 'thanks_button', 16 subaction: 'hideSettingsShortcuts', 17 _ajax_nonce: ThanksSettings.ajax_nonce 18 }, 19 success: function (msg) { 20 if (msg.indexOf('error') < 0) { 21 var all = (document.all) ? document.all : document.getElementsByTagName('*'); 22 for (var i = 0; i < all.length; i++) { 23 // Hide all shortcut settings currently visible 24 if (all[i].className == 'thanks_settings_shortcuts') { 25 all[i].style.display = 'none'; 26 } 27 } 28 } else { 29 alert(msg); 30 } 31 }, 32 error: function (msg) { 33 alert(msg); 34 } 35 }); 36 37} 38 39 40 41function thankYouButtonClick(post_id, done_title) { 42 43 for (i=0; i<10; i++) { // process all thanks buttons included in this post 44 el = document.getElementById('ajax_loader_'+ post_id +'_'+ i); 45 if (el!=undefined) { 46 el.style.visibility = 'visible'; 47 el = document.getElementById('thanksButton_'+ post_id +'_'+ i); 48 if (el!=undefined) { 49 el.title = done_title; 50 el.disabled = 'true'; 51 } 52 } 53 } 54 55 jQuery.ajax({ 56 type: "POST", 57 url: ThanksSettings.ajax_url, 58 data: { post_id: post_id, 59 action: 'thanks_button', 60 subaction: 'thankyou', 61 _ajax_nonce: ThanksSettings.ajax_nonce 62 }, 63 success: function(msg){ 64 if (msg.indexOf('error')<0) { 65 beginTag = msg.indexOf('<thankyou>'); 66 endTag = msg.indexOf('</thankyou>'); 67 if (beginTag>=0 && endTag>0) { 68 msg = msg.substring(beginTag + 10); 69 endTag = msg.indexOf('</thankyou>'); 70 msg = msg.substring(0, endTag); 71 } else { 72 alert('Wrong answer format: '+ msg); 73 return; 74 } 75 var regExp = new RegExp('\\d+$'); 76 for (i=0; i<10; i++) { // process all thanks buttons included in this post 77 el = document.getElementById('thanksButton_'+ post_id +'_'+ i); 78 if (el!=undefined) { 79 el.value = el.value.replace(regExp, msg); 80 el = document.getElementById('ajax_loader_'+ post_id +'_'+ i); 81 if (el!=undefined) { 82 el.style.visibility = 'hidden'; 83 } 84 } 85 } 86 } else { 87 alert(msg); 88 } 89 }, 90 error: function(msg) { 91 alert(msg); 92 } 93 }); 94 95} 96// end of thankYouButtonClick() 97 98 99function thankYouChangeButtonImage(divId, glow) { 100 var bgrImg; 101 102 if (glow) { 103 document.getElementById(divId).style.backgroundImage = 'url('+ ThanksSettings.button_image_glow_url +')'; 104 } else { 105 document.getElementById(divId).style.backgroundImage = 'url('+ ThanksSettings.button_image_url +')'; 106 } 107 108} 109// end of thankYouChangeButtonImage() 110
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.