patternlab/styleguide/public/styleguide/js/patternlab-viewer.js
function (name,val) {
    if (this.findValue(name)) {
      var updateCookieVals = "";
      var cookieVals = $.cookie(this.cookieName).split("|");
      for (var i = 0; i < cookieVals.length; i++) {
        var fieldVals = cookieVals[i].split("~");
        if (fieldVals[0] == name) {
          fieldVals[1] = val;
        }
        updateCookieVals += (i > 0) ? "|"+fieldVals[0]+"~"+fieldVals[1] : fieldVals[0]+"~"+fieldVals[1];
      }
      $.cookie(this.cookieName,updateCookieVals);
    } else {
      this.addValue(name,val);
    }
  }
function (name,val) {
    if (this.findValue(name)) {
      var updateCookieVals = "";
      var cookieVals = $.cookie(this.cookieName).split("|");
      for (var i = 0; i < cookieVals.length; i++) {
        var fieldVals = cookieVals[i].split("~");
        if (fieldVals[0] == name) {
          fieldVals[1] = val;
        }
        updateCookieVals += (i > 0) ? "|"+fieldVals[0]+"~"+fieldVals[1] : fieldVals[0]+"~"+fieldVals[1];
      }
      $.cookie(this.cookieName,updateCookieVals);
    } else {
      this.addValue(name,val);
    }
  }
function ( name , val ) { if ( this . findValue ( name ) ) { var updateCookieVals = "" ; var cookieVals = $ . cookie ( this . cookieName ) . split ( "|" ) ; for ( var i = 0 ; i < cookieVals . length ; i ++ ) { var fieldVals = cookieVals [ i ] . split ( "~" ) ; if ( fieldVals [ 0 ] == name ) { fieldVals [ 1 ] = val ; } updateCookieVals += ( i > 0 ) ? "|" + fieldVals [ 0 ] + "~" + fieldVals [ 1 ] : fieldVals [ 0 ] + "~" + fieldVals [ 1 ] ; } $ . cookie ( this . cookieName , updateCookieVals ) ; } else { this . addValue ( name , val ) ; } }
Update a value found in the cookie. If the key doesn't exist add the value
@param  {String}       the name of the key
@param  {String}       the value
Update a value found in the cookie . If the key doesn t exist add the value