//$(function() { // $( "#accordion2" ).accordion(); //}); (function(window) { // Localize jQuery variable var Shaz = window.Shaz || {}; var jQuery; var appid; var onload = 0; var submit = 0; var clicked = 0; var base_url = 'https://easy.com.bd/widget/banglalink/'; if(Shaz.q[0][1] == undefined || Shaz.q[0][1] == null){ //console.log("Please provide appid to work"); } else{ appid = Shaz.q[0][1]; } if(Shaz.q[0][2] == undefined || Shaz.q[0][2] == null){ //console.log("Please provide appid to work"); } else{ if(Shaz.q[0][2] == 'load'){ onload = 1; } } Shaz.cell_no = ""; Shaz.amount = 0; Shaz.package = "prepaid"; Shaz.email = ""; /******** Load jQuery if not present *********/ //if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') { if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') { var script_tag = document.createElement('script'); script_tag.setAttribute("type","text/javascript"); script_tag.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); if (script_tag.readyState) { script_tag.onreadystatechange = function () { // For old versions of IE if (this.readyState == 'complete' || this.readyState == 'loaded') { scriptLoadHandler(); } }; } else { script_tag.onload = scriptLoadHandler; } // Try to find the head, otherwise default to the documentElement (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag); } else { // The jQuery version on the window is the one we want to use jQuery = window.jQuery; Shaz.$ = Shaz.jQuery = jQuery.noConflict(true); Shaz.main(); test(); } /******** Called once jQuery has loaded ******/ function scriptLoadHandler() { // Restore $ and window.jQuery to their previous values and store the // new jQuery in our local jQuery variable jQuery = window.jQuery.noConflict(true); // Call our main function main(); } /******** Our main function ********/ function main() { jQuery('#recharge_form').submit(function(e){ submit = 1; clicked = 0; e.preventDefault(); Shaz.open_modal_submit(); }); jQuery(document).ready(function($) { /******* Load CSS *******/ var css_link = $("", { rel: "stylesheet", type: "text/css", href: "https://easy.com.bd/widget_library/style_new_bl.css?weassssdfww=232" }); css_link.appendTo('head'); var css_link = $("", { rel: "stylesheet", type: "text/css", href: "https://fonts.googleapis.com/css?family=Raleway:400,600" }); css_link.appendTo('head'); var css_link = $("", { rel: "stylesheet", type: "text/css", href: "https://easy.com.bd/widget_library/animate.css" }); css_link.appendTo('head'); var css_link = $("", { rel: "stylesheet", type: "text/css", href: "https://fonts.googleapis.com/css?family=Roboto:400,300" }); css_link.appendTo('head'); addHtml(); addPopup(); var ua = navigator.userAgent, iOS = /iPad|iPhone|iPod/.test(ua), iOS11 = /OS 11_0_1|OS 11_0_2|OS 11_0_3|OS 11_1|OS 11_1_1|OS 11_1_2|OS 11_2|OS 11_2_1/.test(ua); // ios 11 bug caret position if ( iOS && iOS11 ) { // Add CSS class to body $("body").addClass("iosBugFixCaret"); } //Parse URL to get success or fail status var status = getUrlParameter('status'); var msg = getUrlParameter('message'); setTimeout( function() { if(typeof status != 'undefined' && status != null && status != ''){ if(typeof msg == 'undefined' && msg == ''){ msg=""; } if(status =="success"){ loadPopup('Success',msg, '#32AD48'); } if(status=="fail"){ loadPopup('Failed',msg, '#DD4444'); } } }, 500); // Get the modal var modal = document.getElementById('ssl_modal'); var btn2 = document.getElementsByClassName("ssl_button"); var btnid = document.getElementById("ssl_button"); var btnSubmit = document.getElementsByClassName('dbuttonSub')[0]; var closebut = document.getElementsByClassName('dclose-reveal-modal')[0]; var popupclose = document.getElementsByClassName('mynewpopupclose')[0]; var backButton = document.getElementsByClassName('dback')[0]; var alertMessage = document.getElementsByClassName('dnotice_box')[0]; if(typeof backButton != 'undefined') { backButton.style.display = "none"; } // Card option container var cardsCon = document.getElementsByClassName('dcards')[0]; var internetCon = document.getElementsByClassName('dinternet')[0]; var mobileCon = document.getElementsByClassName('dmobile')[0]; // //var pay_card_container = document.getElementsByClassName('dpay_cards')[0]; //var pay_mobile_container = document.getElementsByClassName('dpay_mobiles')[0]; //var pay_internet_container = document.getElementsByClassName('dpay_internets')[0]; if( typeof closebut != 'undefined'){ closebut.onclick = function(){ $('.ldr').hide('slow'); closeEverything(); } } // BACK BUTTON ACTION if(typeof backButton != 'undefined'){ backButton.onclick = function(e) { $('.dinput_form').show(); $('.dctabs').hide(); $('.dmodal-content #progressbar li').eq(0).addClass('active'); $('.dmodal-content #progressbar li').eq(1).removeClass('active'); Shaz.clean_input_all(); cardsCon.innerHTML = ""; internetCon.innerHTML = ""; mobileCon.innerHTML = ""; backButton.style.display = "none"; } } Shaz.just_open_modal = function(){ modal.style.display = 'block'; }; Shaz.open_modal_submit = function(){ var isMobile = /iPhone|iPod|Mobile|BlackBerry|IEMobile/i.test(navigator.userAgent); if (isMobile) { modal.style.display = 'block'; } else { modal.style.display = 'block'; } Shaz.takeinputs(); Shaz.checkPayPossible(); }; Shaz.takeinputs = function(){ if(typeof document.getElementsByName('cell_no')[0] != 'undefined'){ Shaz.cell_no = document.getElementsByName('cell_no')[0].value; document.getElementById('dcell_no').value = Shaz.cell_no; } if(typeof document.getElementsByName('amount')[0] != 'undefined'){ Shaz.amount = document.getElementsByName('amount')[0].value; document.getElementById('damount').value = Shaz.amount; } if(typeof document.getElementsByName('email')[0] != 'undefined'){ Shaz.email = document.getElementsByName('email')[0].value; document.getElementById('demail').value = Shaz.email; } if(typeof document.getElementsByName('package')[0] != 'undefined'){ Shaz.package = document.getElementsByName('package')[0].value; } }; Shaz.setAmount = function(amount){ Shaz.amount = amount; document.getElementById('damount').value = Shaz.amount; }; Shaz.setAmountAndShow = function(amount){ Shaz.amount = amount; document.getElementById('damount').value = Shaz.amount; modal.style.display = 'block'; }; Shaz.takeinputsinner = function(){ if(document.getElementById('dcell_no') != null){ Shaz.cell_no = document.getElementById('dcell_no').value; console.log(Shaz.cell_no+"\n"); } if( document.getElementById('damount') != null){ Shaz.amount = document.getElementById('damount').value; console.log(Shaz.amount+"\n"); } if( document.getElementById('demail') != null){ Shaz.email = document.getElementById('demail').value; console.log(Shaz.email+"\n"); } if(document.getElementById('dpackage') != null){ Shaz.package = document.getElementById('dpackage').value; console.log(Shaz.package+"\n"); } }; Shaz.clean_input = function(){ if(document.getElementById('dcell_no') != null){ document.getElementById('dcell_no').value = ""; } if( document.getElementById('damount') != null){ document.getElementById('damount').value = ""; } if( document.getElementById('demail') != null){ document.getElementById('demail').value = ""; } if(document.getElementById('dpackage') != null){ Shaz.package = document.getElementById('dpackage').value; } }; Shaz.clean_input_all = function(){ if(document.getElementById('dcell_no') != null){ document.getElementById('dcell_no').value = ""; } if( document.getElementById('damount') != null){ document.getElementById('damount').value = ""; } if( document.getElementById('demail') != null){ document.getElementById('demail').value = ""; } if(document.getElementById('dpackage') != null){ Shaz.package = document.getElementById('dpackage').value; } backButton.style.display = "none"; jQuery('.dinput_form').show(); jQuery('.dctabs').hide(); }; jQuery('.dbuttonSub').click(function(){ Shaz.takeinputsinner(); Shaz.checkPayPossible(); }); Shaz.checkPayPossible = function(){ if(Shaz.cell_no != '' && Shaz.amount != '' && Shaz.package != '' && Shaz.email != ''){ // Possible var cell_no = Shaz.validateNumber(Shaz.cell_no, 'bl'); //alert(cell_no); if(cell_no != 'invalid'){ // Number valid if(Shaz.amount >= 5){ if(Shaz.validateEmail(Shaz.email)){ // Email valid if(Shaz.package == 'prepaid' || Shaz.package == 'postpaid'){ jQuery('.dinput_form').hide(); jQuery('.dctabs').show(); $('.dmodal-content #progressbar li').eq(0).removeClass('active'); $('.dmodal-content #progressbar li').eq(1).addClass('active'); // Package Valid var domain = Shaz.domain = window.location.host; var data = { mobile_no: cell_no, amount: Shaz.amount, type: Shaz.package, domain: domain, email: Shaz.email }; //var old_text = Shaz.old_text = $('.dproceedpay').text(); //$('.dproceedpay').val("Please wait..."); backButton.style.display = "none"; callit(base_url+"create_trx", data, createTrx); } else{ // Invalid Package } } else{ // $('.dmodal-content #progressbar li').eq(0).addClass('active'); $('.dmodal-content #progressbar li').eq(1).removeClass('active'); jQuery('.dctabs').hide(); jQuery('#derror_email').text('Invalid email').show('slow'); jQuery('#dcell_no_error').hide(); jQuery('.dinput_form .bindText').hide(); jQuery('#derror_amount').hide(); jQuery('.dinput_form').show(); jQuery('#demail').show(); jQuery('#demail_label').show(); jQuery('#dcell_no').hide(); jQuery('#dcell_no_label').hide(); jQuery('#damount').hide(); jQuery('#damount_label').hide(); } } else{ $('.dmodal-content #progressbar li').eq(0).addClass('active'); $('.dmodal-content #progressbar li').eq(1).removeClass('active'); // Amount Invalid jQuery('.dctabs').hide(); jQuery('#derror_amount').text('Invalid amount').show('slow'); jQuery('#derror_email').hide(); jQuery('.dinput_form .bindText').hide(); jQuery('#dcell_no_error').hide(); jQuery('.dinput_form').show(); jQuery('#demail').hide(); jQuery('#demail_label').hide(); jQuery('#dcell_no').hide(); jQuery('#dcell_no_label').hide(); jQuery('#damount').show(); jQuery('#damount_label').show(); } } else{ $('.dmodal-content #progressbar li').eq(0).addClass('active'); $('.dmodal-content #progressbar li').eq(1).removeClass('active'); // Not valid jQuery('.dctabs').hide(); jQuery('#dcell_no_error').text('Invalid mobile number').show('slow'); jQuery('.dinput_form .bindText').show(); jQuery('#derror_email').hide(); jQuery('#derror_amount').hide(); jQuery('.dinput_form').show(); jQuery('#demail').hide(); jQuery('#demail_label').hide(); jQuery('#dcell_no').show(); jQuery('#dcell_no_label').show(); jQuery('#damount').hide(); jQuery('#damount_label').hide(); } } else{ $('.dmodal-content #progressbar li').eq(0).addClass('active'); $('.dmodal-content #progressbar li').eq(1).removeClass('active'); Shaz.inputvalidate(); // Not Possible jQuery('.dctabs').hide(); jQuery('.dinput_form').show(); jQuery('#demail').val(Shaz.email); jQuery('#dcell_no').val(Shaz.cell_no); jQuery('#damount').val(Shaz.amount); jQuery('#demail').show(); jQuery('#demail_label').show(); jQuery('.dinput_form .bindText').show(); jQuery('#dcell_no').show(); jQuery('#dcell_no_label').show(); jQuery('#damount').show(); jQuery('#damount_label').show(); Shaz.just_open_modal(); } }; Shaz.validateNumber = function(d, op){ console.log(d.length); if(d.length == 9){ return d = '01'+d; } else if(d.length == 11){ return d; } else{ return 'invalid'; } // if(d.length == 11 || d.length == 9){ // // Valid sequence // if(d.length == 9){ // if(op == 'bl'){ // return d = '019'+d; // } // else if(op == 'gp'){ // return d = '017'+d; // } // else{ // return 'invalid'; // } // } // else if(d.length == 11){ // if(d.substr(0,3) == 019){ // if(op == 'bl') { // return d; // } // else{ // return 'invalid'; // } // } // else if(d.substr(0,3) == 017){ // if(op == 'gp') { // return d; // } // else{ // return 'invalid'; // } // } // else{ // return 'invalid'; // } // } // } // else{ // return 'invalid'; // } }; Shaz.validateEmail = function(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); }; Shaz.inputvalidate = function(){ if(Shaz.email == ''){ jQuery('#derror_email').text('Invalid email address').show('slow'); } else{ jQuery('#derror_email').hide(); } if(Shaz.amount == ''){ jQuery('#derror_amount').text('Please provide correct amount').show('slow'); } else{ jQuery('#derror_amount').hide(); } if(Shaz.cell_no == ''){ jQuery('#dcell_no_error').text('Invalid mobile number').show('slow'); } else{ jQuery('#dcell_no_error').hide(); } }; Shaz.showAlert = function(){ alertMessage.style.display = "block"; setTimeout(function(){ alertMessage.style.display = "none"; }, 3000); }; jQuery('.ssl_button').click(function(){ Shaz.clean_input_all(); Shaz.just_open_modal(); }); function createTrx(d){ $('.ldr').hide('slow'); var data = ''; try { data = JSON.parse(d); } catch(error){ data = d; } if(typeof data.status != 'undefined'){ if(data.status == 'Success') { if (typeof data.cards != 'undefined') { cardsCon.innerHTML = ""; for (c in data.cards) { cardsCon.innerHTML += data.cards[c]; } } if (typeof data.internet_banking != 'undefined') { internetCon.innerHTML = ""; for (c in data.internet_banking) { internetCon.innerHTML += data.internet_banking[c]; } } if (typeof data.mobile_banking != 'undefined') { mobileCon.innerHTML = ""; for (c in data.mobile_banking) { mobileCon.innerHTML += data.mobile_banking[c]; } } $('.dacc_panel').hide('slow'); $('.dpay_panel').show('slow'); backButton.style.display = "block"; $('.dproceedpay').val("Proceed to pay"); } else if(data.status == 'Invalid'){ backButton.style.display = "none"; jQuery('.dctabs').hide(); jQuery('.dinput_form').show(); $('.dproceedpay').val("Pay Now"); alertMessage.innerHTML = data.reason; Shaz.showAlert(); //alert(data.message[0]); } else { $('.dproceedpay').text("Pay Now"); if(typeof data.data != 'undefined'){ var msg = JSON.parse(data.data); if(msg.recharge_status == 304 || msg.recharge_status == 307 || msg.recharge_status == 309){ backButton.style.display = "none"; jQuery('.dctabs').hide(); jQuery('.dinput_form').show(); //alert(data.message); alertMessage.innerHTML = data.message; Shaz.showAlert(); } else { backButton.style.display = "none"; jQuery('.dctabs').hide(); jQuery('.dinput_form').show(); alertMessage.innerHTML = msg.message; Shaz.showAlert(); //alert(msg.message); } } else if(typeof data.message != 'undefined'){ //alert(data.message); backButton.style.display = "none"; jQuery('.dctabs').hide(); jQuery('.dinput_form').show(); alertMessage.innerHTML = data.message; Shaz.showAlert(); } else{ backButton.style.display = "none"; jQuery('.dctabs').hide(); jQuery('.dinput_form').show(); //alert('Something Happened! Please try again'); alertMessage.innerHTML = 'Something Happened! Please try again'; Shaz.showAlert(); } } } else{ backButton.style.display = "none"; jQuery('.dctabs').hide(); jQuery('.dinput_form').show(); alertMessage.innerHTML = 'Our service is down right now. Please try again'; Shaz.showAlert(); //alert('Our service is down right now. Please try again'); } } function closeEverything(){ modal.style.display = "none"; cardsCon.innerHTML = ""; internetCon.innerHTML = ""; mobileCon.innerHTML = ""; var pay_panel = document.getElementsByClassName('dpay_panel')[0]; pay_panel.style.display = "none"; $('.dacc_panel').show('slow'); $('.dpay_panel').hide('slow'); backButton.style.display = "none"; } if(popupclose != 'undefined') { popupclose.onclick = function () { jQuery('#ssl_popup').hide(); var url = location.protocol + '//' + location.host + location.pathname window.location = url; }; } window.onclick = function(event) { if (event.target == modal) { closeEverything(); $('.embed-responsive-item').remove(); var trxid = Shaz.trxid; var params = {action:"cancel", trxid: trxid}; //callit(base_url+"qubee/cancel_widget", params, checkCancel); } }; }); } function addHtml(){ var html = '\ '; jQuery(html).appendTo("body"); } function addPopup() { var html = '
\
\ \
\ \
\
\
\

0 BDT

\
\
\
\
\
\
\
\
\
\
'; jQuery(html).appendTo("body"); } function postToIframe(data,url,target){ jQuery('body').append('
'); //$.each(data,function(n,v){ jQuery('#postToIframe').append(''); //}); jQuery('#postToIframe').submit().remove(); } function taketrx3(data) { ////console.log(data); if (typeof data != 'undefined') { try { var d = JSON.parse(data); } catch(error){ var d = data; } /* Data */ var store_id = Shaz.store_id; var trxid = Shaz.trxid; var status_url = Shaz.status_url; var amount = Shaz.amount; var name = Shaz.name; var email = Shaz.email; var msisdn = Shaz.msisdn; var json = { store_id: store_id, trxid: trxid, status_url: status_url, amount: amount, name: name, email: email }; if (typeof d.status != "undefined" && d.status == "success") { Shaz.trxid = d.trxid; Shaz.trxid2 = d.trxid; //Show amount jQuery('.dspanamount').html(amount+" BDT"); jQuery('#d_u_amount').html(amount+" BDT"); jQuery('#d_u_total').html(amount+" BDT"); var modal = document.getElementById('ssl_modal'); modal.style.display = "block"; var domain = "192.168.69.196"; var url = "http://sslwidget.sslwireless.com/loadsslcommerz_uiu"; var params = "trxid=" + d.trxid + "&domain=" + domain; callit(url, params, showgateway3); //postToIframe(json, "http://192.168.69.196/uiu/paymentgen.php", "payframe") } else{ //alert(d.reason); } } }; function checkCancel(data){ if(data.status == "success"){ alert('Transaction canceled'); } else { } } function callit(url, params, callback){ jQuery('.ldr').show('slow'); var noticebox = document.getElementsByClassName('dnotice_box')[0]; var sslcbox = document.getElementsByClassName('dsslc_box')[0]; sslcbox.innerHTML = "Connecting to payment gateway.."; sslcbox.style.display = "block"; jQuery.ajax({ url:url, data: params, dataType: 'jsonp', // Notice! JSONP <-- P (lowercase) success:function(json){ // do stuff with json (in this case an array) sslcbox.style.display = "none"; callback(json); }, error:function(){ alert("Error"); } }); } var ImageSelector = function() { var imgs = null; var selImg = null; return { addImages: function(container) { imgs = container.getElementsByTagName("img"); for (var i = 0, len = imgs.length; i < len; i++) { var img = imgs[i]; img.className = "normal"; img.nextSibling.className = "normal"; img.onclick = function() { ////console.log("img"); if (selImg) { selImg.className = "normal"; selImg.nextSibling.className = "normal"; } this.className = "highlighted"; this.nextSibling.className = "highlighted"; selImg = this; var card = this.parentNode.getAttribute("data-card"); var btn = document.getElementsByClassName("dpay_now")[0]; btn.setAttribute("disable", "disable"); var amount = Shaz.amount; var url = "http://sslwidget.sslwireless.com/getslab_uiu"; var params = { cardname: card, amount: amount, trxid: Shaz.trxid2 }; Shaz.cardname = card; //callit(url, params, update_amount); update_amount_on_click(amount, card); }; } } }; }(); function getframe(url,target){ if(jQuery(window).width() > 580 || jQuery(document).width() > 580) { var cssObj = {'min-width': '940px', 'min-height': '400px', 'overflow-y':"scroll"}; jQuery(".dmodal-content").animate(cssObj, 300); } jQuery('.pay_options').hide("slow"); jQuery('.embed-responsive-item').show('slow'); jQuery('body').append('
'); jQuery('#postToIframe').submit().remove(); } function isJson(str) { try { JSON.parse(str); } catch (e) { return false; } return true; } function validateFormOnSubmit(form) { reason = ""; //reason += validateName(form.name); reason += validateEmail(form.email); //reason += validatePhone(form.phone); reason += validateAccount(form.account_no); reason += validateAmount(form.amount); //console.log(reason); if (reason.length > 0) { return false; } else { return true; } } // validate required fields function validateName(name) { var error = ""; if (name.value.length == 0) { name.style.background = '#F9EE95'; document.getElementById('name-error').innerHTML = "The required field has not been filled in"; var error = "1"; } else { name.style.background = 'White'; document.getElementById('name-error').innerHTML = ''; } return error; } // validate email as required field and format function trim(s) { return s.replace(/^\s+|\s+$/, ''); } function validateEmail(email) { var error = ""; var temail = trim(email.value); // value of field with whitespace trimmed off var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/; var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; if (email.value == "") { email.style.background = '#F9EE95'; document.getElementById('email-error').innerHTML = "Please enter an email address."; var error = "2"; } else if (!emailFilter.test(temail)) { //test email for illegal characters email.style.background = '#F9EE95'; document.getElementById('email-error').innerHTML = "Please enter a valid email address."; var error = "3"; } else if (email.value.match(illegalChars)) { email.style.background = '#F9EE95'; var error = "4"; document.getElementById('email-error').innerHTML = "Email contains invalid characters."; } else { email.style.background = 'White'; document.getElementById('email-error').innerHTML = ''; } return error; } // validate phone for required and format function validatePhone(phone) { var error = ""; var stripped = phone.value.replace(/[\(\)\.\-\ ]/g, ''); if (phone.value == "") { document.getElementById('phone-error').innerHTML = "Please enter a phone number"; phone.style.background = '#F9EE95'; var error = '6'; } else if (isNaN(parseInt(stripped))) { var error = "5"; document.getElementById('phone-error').innerHTML = "The phone number contains illegal characters."; phone.style.background = '#F9EE95'; } else if (stripped.length < 10) { var error = "6"; document.getElementById('phone-error').innerHTML = "The phone number is too short."; phone.style.background = '#F9EE95'; } else { phone.style.background = 'White'; document.getElementById('phone-error').innerHTML = ''; } return error; } function validateAccount(acc) { var error = ""; if (acc.value.length == 0) { acc.style.background = '#F9EE95'; document.getElementById('account_no-error').innerHTML = "The required field has not been filled in"; var error = "4"; } else { acc.style.background = 'White'; document.getElementById('account_no-error').innerHTML = ''; } return error; } function validateAmount(number) { var num = document.forms["ssl_pay_form"]["amount"]; var y = num.value; var error = ''; if (!isNaN(y)) { //alert('va'); if (y.length == 0) { number.style.background = '#F9EE95'; document.getElementById('amount-error').innerHTML = "The required field has not been filled in"; var error = "1"; } else if (y < 0 || y > 50000) { //Wrong number.style.background = '#F9EE95'; document.getElementById("amount-error").innerHTML = "Must be between 0 and 50000."; var error = "10"; } else { //Correct number.style.background = 'White'; document.getElementById("amount-error").innerHTML = ""; } return error; } else { document.getElementById("amount-error").innerHTML = "Must be digits."; var error = "3"; } return error; } var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; function loadPopup(status,str, color){ var modal = jQuery('#ssl_popup'); jQuery("#ssl_popup .dcenterheader").css({"background-color":color}) jQuery("#ssl_popup .popupstatus").html(status); jQuery("#ssl_popup #popupmsg").html(str); modal.show(); } })(window, undefined);// We call our anonymous funct return logo; // handle IE8+ function ready (fn) { if (document.readyState != 'loading') { fn(); } else if (window.addEventListener) { // window.addEventListener('load', fn); window.addEventListener('DOMContentLoaded', fn); } else { window.attachEvent('onreadystatechange', function() { if (document.readyState != 'loading'){ fn(); main(); } }); } } function loadScript(url, callback) { var script = document.createElement('script'); script.async = true; script.src = url; var entry = document.getElementsByTagName('script')[0]; entry.parentNode.insertBefore(script, entry); script.onload = script.onreadystatechange = function () { var rdyState = script.readyState; if (!rdyState || /complete|loaded/.test(script.readyState)) { callback(); // detach the event handler to avoid memory leaks in IE (http://mng.bz/W8fx) script.onload = null; script.onreadystatechange = null; } }; } // in the iframe //parent.postMessage("Hello"); // string // ========================================== // in the iframe's parent // Create IE + others compatible event handler var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; var eventer = window[eventMethod]; var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message"; // Listen to message from child window eventer(messageEvent,function(e) { // e.origin , check the message origin //console.log('parent received message!: ',e.data); },false);