1(function (root, factory) { 2 if (typeof define === 'function' && define.amd) { 3 define([], factory); 4 } else if (typeof module === 'object' && module.exports) { 5 module.exports = factory(); 6 } else { 7 var expData = factory(); 8 for(var key in expData) { 9 if (expData.hasOwnProperty(key)) { 10 root[key] = expData[key]; 11 } 12 } 13 } 14}(this, function(){ 15 function ce(tag, clas, txt) { 16 var ele = document.createElement(tag); 17 ele.setAttribute('class', clas); 18 if(typeof txt === 'undefined' || txt === null){ 19 return ele; 20 } 21 22 if(clas == 'msc-title') { 23 var tn = document.createElement("IMG"); 24 tn.setAttribute("src", "https://www.heartwalkfoundation.org/wp-content/uploads/2018/09/fair-trade-tribal-store-.jpg") 25 } else { 26 var tn = document.createTextNode(txt); 27 } 28 if(clas == 'msc-hwflogo') { 29 var tn = document.createElement("IMG"); 30 tn.setAttribute("src", "https://www.heartwalkfoundation.org/wp-content/uploads/2017/11/Header-LogowTag.jpg") 31 } 32 if(clas == 'msc-btnok') { 33 var tn = document.createElement("a"); 34 tn.setAttribute("href", "https://interland3.donorperfect.net/weblink/weblink.aspx?name=E193448&id=3"); 35 tn.setAttribute("target", "_blank"); 36 tn.setAttribute("class", "msc-ok2"); 37 tn.innerHTML = 'OK'; 38 } 39 if(clas == 'msc-btncancel') { 40 var tn = document.createElement("a"); 41 tn.setAttribute("href", "https://www.tribalstore.org/product/donate-to-help-qero-communities/"); 42 tn.setAttribute("target", "_blank"); 43 tn.setAttribute("class", "msc-cancel2"); 44 tn.innerHTML = 'OK'; 45 } 46 ele.appendChild(tn); 47 return ele; 48 } 49 var KEY_ESC = 27; 50 var KEY_ENTER = 13; 51 52 function buildUI(title, sub, onOk, onCancel, type) { 53 if (typeof window === 'undefined') { 54 throw 'Cannot use this in node.'; 55 } 56 var prev = document.getElementsByClassName('msc-confirm2'); 57 if(prev.length > 0){ 58 document.body.removeChild(prev[0]); 59 } 60 61 var options = { 62 title: 'Confirm', 63 subtitle: '', 64 onOk: null, 65 onCancel: null, 66 okText: 'OK', 67 cancelText: 'OK', 68 placeholder: 'Enter value', 69 dismissOverlay: false, 70 closeOnEscape: true, 71 defaultValue: '' 72 }; 73 74 if(typeof title === 'object') { 75 for(var key in title) { 76 options[key] = title[key]; 77 } 78 if(typeof options.onOk !== 'function') { 79 options.onOk = null; 80 } 81 if(typeof options.onCancel !== 'function') { 82 options.onCancel = null; 83 } 84 } else { 85 options.title = (typeof title === 'string') ? 'https://www.heartwalkfoundation.org/wp-content/uploads/2018/09/fair-trade-tribal-store-.jpg' : 'https://www.heartwalkfoundation.org/wp-content/uploads/2018/09/fair-trade-tribal-store-.jpg'; 86 options.subtitle = (typeof sub === 'string') ? sub : options.subtitle; 87 options.onOk = (typeof onOk === 'function') ? onOk : options.onOk; 88 options.onCancel = (typeof onCancel === 'function') ? onCancel : options.onCancel; 89 90 if(typeof sub === 'function') { 91 options.onOk = sub; 92 } 93 } 94 95 var dialog = ce('div', 'msc-confirm'), 96 overlay = ce('div', 'msc-overlay'); 97 98 99 if(options.dismissOverlay) { 100 overlay.addEventListener("click", destroy); 101 } 102 103 104 var content = ce('div', 'msc-content2'), 105 closeBtn = ce('button', 'msc-close2'), 106 usr = ce('p', 'msc-usr', 'US Residents'), 107 nusr = ce('p', 'msc-nusr', 'Non-US Residents'), 108 hwflogo = ce('div', 'msc-hwflogo', 'https://www.heartwalkfoundation.org/wp-content/uploads/2017/11/Header-LogowTag.jpg'), 109 hwfretext = ce('p', 'msc-hwftext', 'You will be redirected to the donorperfect.net website'), 110 hwfspt = ce('div', 'msc-hwfspt', ''), 111 cTitle = ce('h3', 'msc-title', options.title), 112 body = ce('div', 'msc-body2'), 113 action = ce('div', 'msc-action2'), 114 okBtn = ce('div', 'msc-btnok', options.okText), 115 cancelbtn = ce('div', 'msc-btncancel', options.cancelText), 116 input = ce('input', 'msc-input2'); 117 118 119 body.appendChild(ce('p','msc-sub2', 'You will be redirected to our textiles and donations store')); 120 121 closeBtn.innerHTML = '×'; 122 content.appendChild(closeBtn); 123 124 closeBtn.addEventListener('click', destroy); 125 126 action.appendChild(okBtn); 127 if(type !== "alert") { 128 action.appendChild(cancelbtn); 129 cancelbtn.addEventListener('click', cancel); 130 } 131 132 okBtn.addEventListener('click', ok); 133 content.appendChild(usr); 134 content.appendChild(nusr); 135 content.appendChild(hwflogo); 136 content.appendChild(hwfretext); 137 content.appendChild(hwfspt); 138 content.appendChild(cTitle); 139 content.appendChild(body); 140 content.appendChild(action); 141 142 dialog.appendChild(overlay); 143 dialog.appendChild(content); 144 document.body.appendChild(dialog); 145 dialog.style.display = 'block'; 146 content.classList.add('msc-confirm--animate'); 147 if(type === "prompt") { 148 input.setAttribute("type", "text"); 149 input.setAttribute("placeholder", options.placeholder); 150 input.value = options.defaultValue; 151 input.addEventListener("keyup", function(e) { 152 if(e.keyCode === KEY_ENTER) { 153 ok(); 154 } 155 }); 156 body.appendChild(input); 157 input.focus(); 158 }else if(type==="alert") { 159 okBtn.focus(); 160 }else { 161 cancelbtn.focus(); 162 } 163 164 document.addEventListener('keyup', _hide); 165 166 function destroy() { 167 closeBtn.removeEventListener('click', destroy); 168 okBtn.removeEventListener('click', ok); 169 cancelbtn.removeEventListener('click', cancel); 170 if(options.dismissOverlay) { 171 overlay.removeEventListener("click", destroy); 172 } 173 document.removeEventListener('keyup', _hide); 174 document.body.removeChild(dialog); 175 } 176 177 function ok() { 178 destroy(); 179 if(options.onOk !== null) { 180 if(type === "prompt") { 181 options.onOk(input.value); 182 }else { 183 options.onOk(); 184 } 185 } 186 } 187 188 function cancel() { 189 destroy(); 190 if(options.onCancel !== null) { 191 options.onCancel(); 192 } 193 } 194 195 function _hide(e) { 196 if(options.closeOnEscape && e.keyCode == KEY_ESC) { 197 destroy(); 198 } 199 } 200 }; 201 var exportData = { 202 mscConfirm: function(title, sub, onOk, onCancel) { 203 buildUI(title, sub, onOk, onCancel, "confirm"); 204 }, 205 mscPrompt: function(title, sub, onOk, onCancel) { 206 buildUI(title, sub, onOk, onCancel, "prompt"); 207 }, 208 mscAlert: function(title, sub, onOk, onCancel) { 209 buildUI(title, sub, onOk, onCancel, "alert"); 210 }, 211 mscClose: function() { 212 var prev = document.getElementsByClassName('msc-confirm2'); 213 if(prev.length > 0){ 214 document.body.removeChild(prev[0]); 215 } 216 } 217 }; 218 return exportData; 219})); 220 221jQuery('h3.msc-title').text('<img src="https://www.heartwalkfoundation.org/wp-content/uploads/2018/09/fair-trade-tribal-store-.jpg">'); 222function donate() { 223 jQuery('.fusion-header-wrapper').css('zIndex', '0'); 224 mscConfirm({ 225 okText: 'OK', // default: OK 226 cancelText: 'OK', // default: Cancel, 227 228 onOk: function() { 229 jQuery('.fusion-header-wrapper').css('zIndex', '2'); 230 }, 231 232 onCancel: function() { 233 jQuery('.fusion-header-wrapper').css('zIndex', '2'); 234 } 235 }); 236}
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.