// Source var txSrc = txSrc || location.protocol + '//www.tariffuxx.de'; if (location.hostname == 'localhost') txSrc = location.protocol + '//localhost/tarifuxx'; // Create/Get Object var txData = txData || {}; txData.txhandytarifrechnersim = txData.txhandytarifrechnersim || {tariffuxx2317 : {}}; // Create Data Structure with table settings txData.txhandytarifrechnersim.tariffuxx2317 = createTxData('txhandytarifrechnersim', {"txkd":"398","txproj":"463","provider":"15-11","txtarife":"6","txfilter":"3","txstart":"1","inet":"30","laufzeit":"0","net1":"td1","txeff":"16"}, {"bgcolor":"","fontcolor":"","theadcolor":"","tevencolor":"","toddcolor":"","thighlight":"","hifontcolor":"#006699","bgabutton":"#e10919","coabutton":"#FFFFFF","bgbutton":"#e10919","cobutton":"#666666","bgtariftipp":"#FAF0E6","coaktion":"#FFFFFF","bgaktion":"#e10919","boraktion":"#f1858d","customcss":""}); // Create Data Structure with default settings function createTxData (cmp, opt, pc){ txDataStructure = { pref : { kd : parseInt(opt.txkd) || 1, hnb : 12 || '', filter : parseInt(opt.txfilter) || 0, subid : opt.subid || '', start : opt.txstart || 0, tarifcount : parseInt(opt.txtarife) || 20, txlabel : opt.txlabel || '', txsublabel : opt.txsublabel || '', txBxMin : 2, txBxMax : 7, track : 0, ttseen : false, phoneData : '', overlayFlag : '', showfilter : 0, width : 0, bannerWidth: 0, globalWidth: 0, handyShopHeight: 0, tarife : {}, tarifCountLive : 0, tarifCountTotal : 0, nameInet : {0: 'keine', 10: '250 MB', 20: '500 MB', 30: '1 GB', 40: '2 GB', 50: '3 GB', 60: '5 GB', 70: '7,5 GB', 80: '10 GB', 90: '15 GB', 100: '20 GB'}, valInet : {0: '0', 10: '250', 20: '500', 30: '1000', 40: '2000', 50: '3000', 60: '5000', 70: '7500', 80: '10000', 90: '15000', 100: '20000'}, nameSpeed : {0: '7 Mbit/s', 10: '21 Mbit/s', 20: '42 Mbit/s', 30: '50 Mbit/s', 40: '150 Mbit/s', 50: '300+ Mbit/s'}, valSpeed : {0: '7.0', 10: '21.0', 20: '42.0', 30: '50.0', 40: '150.0', 50: '300.0'}, nameFestSpeed : {0: '10 Mbit/s', 10: '25 Mbit/s', 20: '50 Mbit/s', 30: '100 Mbit/s', 40: '200 Mbit/s', 50: '300+ Mbit/s'}, valFestSpeed : {0: '10.0', 10: '25.0', 20: '50.0', 30: '100.0', 40: '200.0', 50: '300.0'}, namePhonePrice : {0: '1 €', 10: '50 €', 20: '100 €', 30: '150 €', 40: '200 €', 50: 'Alle'}, valPhonePrice : {0: '1', 10: '50', 20: '100', 30: '150', 40: '200', 50: '0'}, }, prms : { txtid : 2317, txtable : cmp, proj : parseInt(opt.txproj) || 0, button : opt.txbutton || '', aff : opt.affilid || '', afftarife : opt.txafftarife || 0, affop : opt.txaffop || 0, all: opt.all || 0, provider : opt.provider || '', tarif : opt.tarif || '', eff : opt.txeff || 50, ap : opt.ap || -1, hardware : opt.txhrd || '', hardwareid : opt.txhrdid || '', hrdid : opt.txhrdid || '', phone : opt.txphone || '', phoneprice : opt.txphnprc || 50, hspeicher : '', hfarbe : '', plz : opt.txplz || 0, hrdwifi : opt.txhrdwifi || 0, tel : opt.txtel || 0, mobil : opt.txmobil || 0, tv : opt.txtv || 0, type : opt.txtype || 0, newc : opt.txnewc || 0, swtchc : opt.txswtchc || 0, chpst : opt.txchpst || 0, internetopt : opt.txinetflat || 0, vol : opt.inet || 10, speed : opt.speed || 0, netlte : opt.lte || 0, dataauto : opt.txdataauto || 0, telopt : 50, smsopt : opt.sms || 0, laufzeit : opt.laufzeit || 24, typ : opt.txtyp || '', zahlart : opt.art || '', net1 : 'td1', net2 : 'vd2', net3 : 'o2', net4 : '', rnmn : opt.rnmn || 1, music : opt.music || 0, audience : opt.audience || 0, }, clrs : { bg : pc.bgcolor || '', fc : pc.fontcolor || '', th : pc.theadcolor || '', thc : pc.toddcolor || '', tre : pc.tevencolor || '', thf : pc.hifontcolor || '', abg : pc.bgabutton || '', abgh : '', afc : pc.coabutton || '', bbg : pc.bgbutton || '', bbgh : '', bfc : pc.cobutton || '', tbg : pc.bgtariftipp || '', tbb : pc.bgaktion || '', tbbh : '', tfc : pc.coaktion || '', tcss : pc.customcss || '' } } /*** Handle dependencies ***/ // Handle Table specific Colors txDataStructure.clrs.bg = (opt.bg) ? '#' + opt.bg : txDataStructure.clrs.bg; txDataStructure.clrs.fc = (opt.fc) ? '#' + opt.fc : txDataStructure.clrs.fc; txDataStructure.clrs.th = (opt.th) ? '#' + opt.th : txDataStructure.clrs.th; txDataStructure.clrs.thc = (opt.thc) ? '#' + opt.thc : txDataStructure.clrs.thc; txDataStructure.clrs.tre = (opt.tre) ? '#' + opt.tre : txDataStructure.clrs.tre; txDataStructure.clrs.thf = (opt.thf) ? '#' + opt.thf : txDataStructure.clrs.thf; txDataStructure.clrs.abg = (opt.abg) ? '#' + opt.abg : txDataStructure.clrs.abg; txDataStructure.clrs.afc = (opt.afc) ? '#' + opt.afc : txDataStructure.clrs.afc; txDataStructure.clrs.bbg = (opt.bbg) ? '#' + opt.bbg : txDataStructure.clrs.bbg; txDataStructure.clrs.bfc = (opt.bfc) ? '#' + opt.bfc : txDataStructure.clrs.bfc; txDataStructure.clrs.tbg = (opt.tbg) ? '#' + opt.tbg : txDataStructure.clrs.tbg; txDataStructure.clrs.tbb = (opt.tbb) ? '#' + opt.tbb : txDataStructure.clrs.tbb; txDataStructure.clrs.tfc = (opt.tfc) ? '#' + opt.tfc : txDataStructure.clrs.tfc; // Handle hover color if (txDataStructure.clrs.abg) { txDataStructure.clrs.abgh = change_brightness(txDataStructure.clrs.abg, -25); } if (txDataStructure.clrs.bbg) { txDataStructure.clrs.bbgh = change_brightness(txDataStructure.clrs.bbg, -25); } if (txDataStructure.clrs.tbb) { txDataStructure.clrs.tbbh = change_brightness(txDataStructure.clrs.tbb, 50); } // affilinet partner id if (opt.affilid && !isNaN(opt.affilid)) { txDataStructure.pref.kd = 41; txDataStructure.prms.aff = txDataStructure.prms.aff + '|hnb=12'; } // subid if (opt.subid && opt.subid.length <= 64) { txDataStructure.pref.subid = opt.subid.replace(/[\W_]+/g, ''); if (txDataStructure.pref.kd == 41) txDataStructure.prms.aff += '|'; txDataStructure.prms.aff += opt.subid.replace(/[\W_]+/g, ""); } // tarif counter if (txDataStructure.pref.tarifcount != 20 && opt.txtarife && !isNaN(opt.txtarife)) { if (opt.txtarife < 3) { txDataStructure.pref.tarifcount = 3; } else if (opt.txtarife > 20) { txDataStructure.pref.tarifcount = 20; } } // telephone costs unity if (opt.tel) { if (opt.tel < 500) { txDataStructure.prms.telopt = (Math.round(opt.tel / 100 * 4)) / 4 * 100; } else { txDataStructure.prms.telopt = 500; } } // net preselection if (opt.net1 || opt.net2 || opt.net3) { if (!opt.net1 || opt.net1 != 'td1') txDataStructure.prms.net1 = ''; if (!opt.net2 || opt.net2 != 'vd2') txDataStructure.prms.net2 = ''; if (!opt.net3 || opt.net3 != 'o2') txDataStructure.prms.net3 = ''; } // Check if Provider tariff overview if (txDataStructure.prms.provider != '' && txDataStructure.prms.provider.search('-') == -1) { txDataStructure.prms.eff = 50; txDataStructure.prms.phone = ''; txDataStructure.prms.hspeicher = ''; txDataStructure.prms.hfarbe = ''; txDataStructure.prms.internetopt = 0; txDataStructure.prms.vol = 0 ; txDataStructure.prms.speed = 0; txDataStructure.prms.netlte = 0; txDataStructure.prms.dataauto = 1; txDataStructure.prms.telopt = 0; txDataStructure.prms.smsopt = 0; txDataStructure.prms.laufzeit = 24; txDataStructure.prms.zahlart = ''; txDataStructure.prms.net1 = 'td1'; txDataStructure.prms.net2 = 'vd2'; txDataStructure.prms.net3 = 'o2'; txDataStructure.prms.rnmn = 0; txDataStructure.prms.music = 0; txDataStructure.prms.audience = 0; } // Allnet Table default specifications if (cmp == 'txhandyallnettarife') { txDataStructure.pref.start = 1; txDataStructure.prms.telopt = 1; } // Prepaid Table default specifications if (cmp == 'txhandyprepaidtarife') { txDataStructure.pref.start = 1; txDataStructure.prms.telopt = 0; txDataStructure.prms.laufzeit = 24; txDataStructure.prms.zahlart = 'prepaid'; } // Smrtphone Bundle table default specifications if ((cmp == 'txhandyshop' || cmp == 'txhandygalery') && txDataStructure.pref.start != '' && txDataStructure.pref.start != 1) { txDataStructure.prms.phone = txDataStructure.pref.start.toLowerCase(); txDataStructure.pref.start = 1; } // Tarifrechner default specifications if (cmp == 'txhandytarifrechner' && txDataStructure.prms.phone !== '') { txDataStructure.pref.start = 1; } // Banner table default specifications if (cmp == 'txhandybanner') { txDataStructure.pref.start = 1; } // Data Flat Table default specification if (cmp == 'txdatentarife') { txDataStructure.pref.start = 1; txDataStructure.prms.typ = 'Flatrate'; } if(cmp == 'txSurfPrepaidTarife') { txDataStructure.pref.start = 1; txDataStructure.prms.typ = 'Flatrate-Tagesflatrate-Surf+Pakete'; txDataStructure.prms.zahlart = 'prepaid'; } if(cmp == 'txfestnetz') { txDataStructure.pref.start = 1; txDataStructure.pref.aff = opt.mrdslid || ''; txDataStructure.prms.eff = 0; txDataStructure.prms.speed = opt.txspeed || 0; } // console.log(txDataStructure); return txDataStructure; } // Create container var scriptTag = document.getElementsByTagName('script'); //console.log(scriptTag); // scriptTag = scriptTag[scriptTag.length - 1]; // console.log(scriptTag); var s = scriptTag.length, f = 0; while (s--) { if (scriptTag[s].src.indexOf('tables/view/2317') >= 0) { f = s; break; } } scriptTag = scriptTag[f]; var parentTag = scriptTag.parentNode; var container = document.createElement("div") container.id = "tariffuxx2317"; container.setAttribute('cmpid', 'txhandytarifrechnersim'); container.classList.add("tariffuxx"); container.style = "display:none"; parentTag.appendChild(container); var list = document.getElementsByTagName('script'); //console.log(list); var i = list.length, flag = false; while (i--) { //console.log(list[i]); if (list[i].src === 'http://tariffuxx.de/services/php/txhandytarifs.php?v=3.1.7') { flag = true; } if (list[i].src === 'https://tariffuxx.de/services/php/txhandytarifs.php?v=3.1.7') { flag = true; } if (list[i].src === 'https://www.tariffuxx.de/services/php/txhandytarifs.php?v=3.1.7') { flag = true; } if (list[i].src === 'http://www.tariffuxx.de/services/php/txhandytarifs.php?v=3.1.7') { flag = true; } /*if (list[i].src === 'http://localhost/tarifuxx/services/php/txhandytarifs.php?v=3.1.7') { flag = true; } console.log(flag); console.log('---------------------------------------');*/ if (flag === true) { break; } } if (!flag) { var uri = "https://tariffuxx.de/services/php/txhandytarifs.php?v=3.1.7"; var txTableScript = document.createElement("script") txTableScript.type = "text/javascript"; txTableScript.src = uri; document.getElementsByTagName("head")[0].appendChild(txTableScript); var txStartTable = 'tariffuxx2317'; } txData.txhandytarifrechnersim.tariffuxx2317.pref.track = 1; function change_brightness(hex, percent){ // strip the leading # if it's there hex = hex.replace(/^\s*#|\s*$/g, ''); // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF` if(hex.length == 3){ hex = hex.replace(/(.)/g, '$1$1'); } // reverse brigthness if black or white if (hex === '000000') percent = percent * -1; if (hex === 'ffffff') percent = percent * -1; var r = parseInt(hex.substr(0, 2), 16), g = parseInt(hex.substr(2, 2), 16), b = parseInt(hex.substr(4, 2), 16); if (percent > 0) { return '#' + ((0|(1<<8) + r + (256 - r) * percent / 100).toString(16)).substr(1) + ((0|(1<<8) + g + (256 - g) * percent / 100).toString(16)).substr(1) + ((0|(1<<8) + b + (256 - b) * percent / 100).toString(16)).substr(1); } else { percent = percent * -1; return '#' + ((0|(1<<8) + r * (100 - percent) / 100).toString(16)).substr(1) + ((0|(1<<8) + g * (100 - percent) / 100).toString(16)).substr(1) + ((0|(1<<8) + b * (100 - percent) / 100).toString(16)).substr(1); } } // Tooltip var qTipX = 0, qTipY = 20; tooltip = { name: "tx-qtip", offsetX: qTipX, offsetY: qTipY, tip: null }, tooltip.init = function() { if (!t) var t = "tx-qtip"; var e, o, i, n = document.getElementById(t); if ((n || ((n = document.createElementNS ? document.createElementNS("http://www.w3.org/1999/xhtml", "div") : document.createElement("div")).setAttribute("id", t), document.getElementsByTagName("body").item(0).appendChild(n)), document.getElementById) && (this.tip = document.getElementById(this.name), this.tip && (document.onmousemove = function(t) { tooltip.move(t) }), i = document.getElementsByClassName('tx-tip'))) for (var l = 0; l < i.length; l++)(o = (e = i[l]).getAttribute("tx-tiptitle")) && (e.setAttribute("tx-tiptitle", o), e.removeAttribute("title"), e.removeAttribute("alt"), e.onmouseover = function() { tooltip.show(this.getAttribute("tx-tiptitle")) }, e.onmouseout = function() { tooltip.hide() }) }, tooltip.move = function(t) { var e = 0, o = 0; document.all ? (e = document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft, o = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop, e += window.event.clientX, o += window.event.clientY) : (e = t.pageX, o = t.pageY), document.body.getBoundingClientRect() - e < 260 && (e -= 280 - (document.body.getBoundingClientRect() - e)), this.tip.style.left = e + "px", this.tip.style.top = o + this.offsetY + "px", this.tip.style.zIndex = "2147483647" }, tooltip.show = function(t) { this.tip && (this.tip.innerHTML = t, this.tip.style.display = "block") }, tooltip.hide = function() { this.tip && (this.tip.innerHTML = "", this.tip.style.display = "none") };