Plugin Directory

Changeset 1933344


Ignore:
Timestamp:
08/30/2018 06:26:59 PM (8 years ago)
Author:
Bigandy
Message:

deleting trunk from tags/1.0

Location:
wp-content-personalization
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • wp-content-personalization/trunk/js/wpcp-foot.js

    r1933190 r1933344  
    1 var setCookie = function (cookieName, cookieValue, expiresAfterDays) {
     1var setCookie = function(cookieName, cookieValue, expiresAfterDays) {
    22    var d = new Date();
    3     d.setTime(d.getTime() + (expiresAfterDays * 24 * 60 * 60 * 1000));
    4     var expires = 'expires=' + d.toUTCString();
    5     document.cookie = cookieName + '=' + cookieValue + ';' + expires + ';path=/';
     3    d.setTime(d.getTime() + expiresAfterDays * 24 * 60 * 60 * 1000);
     4    var expires = "expires=" + d.toUTCString();
     5    document.cookie = cookieName + "=" + cookieValue + ";" + expires + ";path=/";
    66};
    77
    8 var getCookie = function (cookieName) {
    9     var name = cookieName + '=';
    10     var ca = document.cookie.split(';');
     8var getCookie = function(cookieName) {
     9    var name = cookieName + "=";
     10    var ca = document.cookie.split(";");
    1111
    12     for(var i = 0; i < ca.length; i++) {
     12    for (var i = 0; i < ca.length; i++) {
    1313        var c = ca[i];
    14         while (c.charAt(0) == ' ') {
     14        while (c.charAt(0) == " ") {
    1515            c = c.substring(1);
    1616        }
     
    1919        }
    2020    }
    21     return '';
     21    return "";
    2222};
    2323
    2424document.addEventListener("DOMContentLoaded", function() {
    25     var varBlocks = document.querySelectorAll('.var-block');
     25    var varBlocks = document.querySelectorAll(".var-block");
    2626
    2727    varBlocks.forEach(function(block) {
    28         block.style.display = 'none';
     28        block.style.display = "none";
    2929
    30         var parentqm = block.getAttribute('data-qm').split('-'),
    31             parentqid = 'q-' + parentqm[1],
    32             dcookie = getCookie('vh-' + parentqid);
     30        var parentqm = block.getAttribute("data-qm").split("-"),
     31            parentqid = "q-" + parentqm[1],
     32            dcookie = getCookie("vh-" + parentqid);
    3333
    34         if (dcookie === '' && block.classList.contains('var-block--default')) {
    35             block.style.display = 'block';
     34        if (dcookie === "" && block.classList.contains("var-block--default")) {
     35            block.style.display = "block";
    3636
    37             var answers = document.querySelectorAll('.q-answers');
     37            var answers = document.querySelectorAll(".q-answers");
    3838            answers.forEach(function(answer) {
    39                 answer.querySelector('span').classList.add('selected');
     39                answer.querySelector("span").classList.add("selected");
    4040            });
    41         } else if (block.getAttribute('data-qm') === parentqid + '-' + dcookie) {
    42             block.style.display = 'block';
     41        } else if (block.getAttribute("data-qm") === parentqid + "-" + dcookie) {
     42            block.style.display = "block";
    4343
    44             $('#' + parentqid + ' .' + dcookie).addClass('selected');
     44            document
     45                .querySelector("#" + parentqid + " ." + dcookie)
     46                .classList.add("selected");
    4547        }
    4648    });
    4749
    4850    // Click on answer, show the correct content.
    49     var answers = document.querySelectorAll('.q-answers span');
     51    var answers = document.querySelectorAll(".q-answers span");
    5052
    5153    answers.forEach(function(answer) {
    52         answer.addEventListener('click', function() {
    53             var questionsID = answer.parentNode.parentNode.getAttribute('id'),
    54                 questionValue = this.getAttribute('class').split(' ')[0];
     54        answer.addEventListener("click", function() {
     55            var questionsID = answer.parentNode.parentNode.getAttribute("id"),
     56                questionValue = this.getAttribute("class").split(" ")[0];
    5557
    5658            // Hide all answer content for this question.
    57             document.querySelectorAll('[data-qm^="' + questionsID + '"].var-block').forEach(function(question){
    58                 question.style.display = 'none';
    59             });
     59            document
     60                .querySelectorAll('[data-qm^="' + questionsID + '"].var-block')
     61                .forEach(function(question) {
     62                    question.style.display = "none";
     63                });
    6064
    61             if (false === this.classList.contains('selected')) {
    62                 document.querySelectorAll('[data-qm="' + questionsID + '-' + questionValue + '"].var-block').forEach(function(question){
    63                     question.style.display = 'block';
    64                 });
     65            if (false === this.classList.contains("selected")) {
     66                document
     67                    .querySelectorAll(
     68                        '[data-qm="' + questionsID + "-" + questionValue + '"].var-block'
     69                    )
     70                    .forEach(function(question) {
     71                        question.style.display = "block";
     72                    });
    6573            }
    6674
     
    6876            var children = this.parentNode.children;
    6977            for (var i = 0; i < children.length; i++) {
    70                 children[i].classList.remove('selected');
     78                children[i].classList.remove("selected");
    7179            }
    72             this.classList.add('selected');
     80            this.classList.add("selected");
    7381
    74             setCookie('vh-' + questionsID, questionValue, '1000');
     82            setCookie("vh-" + questionsID, questionValue, "1000");
    7583        });
    7684    });
  • wp-content-personalization/trunk/js/wpcp-foot.min.js

    r1933190 r1933344  
    1 var setCookie=function(e,t,o){var n=new Date;n.setTime(n.getTime()+24*o*60*60*1e3);var s="expires="+n.toUTCString();document.cookie=e+"="+t+";"+s+";path=/"},getCookie=function(e){for(var t=e+"=",o=document.cookie.split(";"),n=0;n<o.length;n++){for(var s=o[n];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""};document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".var-block").forEach(function(e){e.style.display="none";var t="q-"+e.getAttribute("data-qm").split("-")[1],o=getCookie("vh-"+t);""===o&&e.classList.contains("var-block--default")?(e.style.display="block",document.querySelectorAll(".q-answers").forEach(function(e){e.querySelector("span").classList.add("selected")})):e.getAttribute("data-qm")===t+"-"+o&&(e.style.display="block",$("#"+t+" ."+o).addClass("selected"))}),document.querySelectorAll(".q-answers span").forEach(function(s){s.addEventListener("click",function(){var e=s.parentNode.parentNode.getAttribute("id"),t=this.getAttribute("class").split(" ")[0];document.querySelectorAll('[data-qm^="'+e+'"].var-block').forEach(function(e){e.style.display="none"}),!1===this.classList.contains("selected")&&document.querySelectorAll('[data-qm="'+e+"-"+t+'"].var-block').forEach(function(e){e.style.display="block"});for(var o=this.parentNode.children,n=0;n<o.length;n++)o[n].classList.remove("selected");this.classList.add("selected"),setCookie("vh-"+e,t,"1000")})})});
     1var setCookie=function(e,t,o){var n=new Date;n.setTime(n.getTime()+24*o*60*60*1e3);var s="expires="+n.toUTCString();document.cookie=e+"="+t+";"+s+";path=/"},getCookie=function(e){for(var t=e+"=",o=document.cookie.split(";"),n=0;n<o.length;n++){for(var s=o[n];" "==s.charAt(0);)s=s.substring(1);if(0==s.indexOf(t))return s.substring(t.length,s.length)}return""};document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".var-block").forEach(function(e){e.style.display="none";var t="q-"+e.getAttribute("data-qm").split("-")[1],o=getCookie("vh-"+t);""===o&&e.classList.contains("var-block--default")?(e.style.display="block",document.querySelectorAll(".q-answers").forEach(function(e){e.querySelector("span").classList.add("selected")})):e.getAttribute("data-qm")===t+"-"+o&&(e.style.display="block",document.querySelector("#"+t+" ."+o).classList.add("selected"))}),document.querySelectorAll(".q-answers span").forEach(function(s){s.addEventListener("click",function(){var e=s.parentNode.parentNode.getAttribute("id"),t=this.getAttribute("class").split(" ")[0];document.querySelectorAll('[data-qm^="'+e+'"].var-block').forEach(function(e){e.style.display="none"}),!1===this.classList.contains("selected")&&document.querySelectorAll('[data-qm="'+e+"-"+t+'"].var-block').forEach(function(e){e.style.display="block"});for(var o=this.parentNode.children,n=0;n<o.length;n++)o[n].classList.remove("selected");this.classList.add("selected"),setCookie("vh-"+e,t,"1000")})})});
Note: See TracChangeset for help on using the changeset viewer.