Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
integration:foxycart:multiship_javascript_070 [2013/04/02 06:04] – [Data entry] adamintegration:foxycart:multiship_javascript_070 [2017/04/26 07:02] (current) – external edit 127.0.0.1
Line 4: Line 4:
 name          : multiship_jquery_070+ #the name of the integration name          : multiship_jquery_070+ #the name of the integration
 description   : (FC 0.7.0+) jQuery to automatically create a select box ("drop down") with previously entered ship-to addresses, with showing/hiding of the "New recipient" field. description   : (FC 0.7.0+) jQuery to automatically create a select box ("drop down") with previously entered ship-to addresses, with showing/hiding of the "New recipient" field.
-tags_tags     : multiship #tags, separated by commas. don't include the "system" here.+tags          : multiship #tags, separated by commas. don't include the "system" here.
 date_dt       : 2011-06-20 #the date in YYYY-MM-DD format date_dt       : 2011-06-20 #the date in YYYY-MM-DD format
 version       : 2.3 #if you have a version for your code, enter it here version       : 2.3 #if you have a version for your code, enter it here
Line 107: Line 107:
  jQuery.each(shipto, function(i, val){  jQuery.each(shipto, function(i, val){
  // alert('starting the .each loop with: ' + i + ' = ' + val);  // alert('starting the .each loop with: ' + i + ' = ' + val);
- if (val != 'undefined' && val != 'null' && val != '' && val != 'me') {+ if (val != 'undefined' && val != 'null' && val != '' && val != 'Me') {
  shipto_options += '<option value="' + val + '">' + val + '<\/option>';  shipto_options += '<option value="' + val + '">' + val + '<\/option>';
  // alert('and it worked: ' + val);  // alert('and it worked: ' + val);
Line 119: Line 119:
  shipto_options += '<option value="add_new">Add a new recipient...<\/option>';  shipto_options += '<option value="add_new">Add a new recipient...<\/option>';
  shipto_options += '<option value="">- - - - - - - - -<\/option>';  shipto_options += '<option value="">- - - - - - - - -<\/option>';
- shipto_options += '<option selected="selected" value="me">Yourself<\/option>';+ shipto_options += '<option selected="selected" value="Me">Yourself<\/option>';
    
  // Set the select boxes with the proper values  // Set the select boxes with the proper values
Line 144: Line 144:
  jQuery('div.shipto_select select').val(jQuery.cookie('shipto_name_recent')).change();  jQuery('div.shipto_select select').val(jQuery.cookie('shipto_name_recent')).change();
  } else {  } else {
- jQuery('div.shipto_select select').val('me').change();+ jQuery('div.shipto_select select').val('Me').change();
  }  }
    
Line 180: Line 180:
  jQuery.cookie('shipto_name_recent', shipto_new, {expires: 300, path: '/', domain: location.host.match('[^.]+.[^.]+$')});  jQuery.cookie('shipto_name_recent', shipto_new, {expires: 300, path: '/', domain: location.host.match('[^.]+.[^.]+$')});
    
- if ((shipto_new != 'undefined') && (shipto_new != 'null') && (shipto_new != 'me')) {+ if ((shipto_new != 'undefined') && (shipto_new != 'null') && (shipto_new != 'Me')) {
  jQuery.cookie('shipto_names', '', {expires: -1, path: '/', domain: location.host.match('[^.]+.[^.]+$')});  jQuery.cookie('shipto_names', '', {expires: -1, path: '/', domain: location.host.match('[^.]+.[^.]+$')});
  jQuery.cookie('shipto_names', shipto_cookie + '||' + shipto_new, {expires: 300, path: '/', domain: location.host.match('[^.]+.[^.]+$')});  jQuery.cookie('shipto_names', shipto_cookie + '||' + shipto_new, {expires: 300, path: '/', domain: location.host.match('[^.]+.[^.]+$')});
Line 221: Line 221:
 } }
 // ============================================================================ // ============================================================================
-  
-  
-  
    
    
    
 // ============================================================================ // ============================================================================
-/** +/*! 
- * Cookie plugin + jQuery Cookie Plugin v1.3.1 
- * + https://github.com/carhartl/jquery-cookie
- * Copyright (c) 2006 Klaus Hartl (stilbuero.de) +
- Dual licensed under the MIT and GPL licenses: +
- * http://www.opensource.org/licenses/mit-license.php +
- * http://www.gnu.org/licenses/gpl.html+
  *  *
 + * Copyright 2013 Klaus Hartl
 + * Released under the MIT license
  */  */
-  +(function(d){"function"===typeof define&&define.amd?define(["jquery"],d):d(jQuery)})(function(d){function m(a){return a}function n(a){return decodeURIComponent(a.replace(j," "))}function k(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e.json?JSON.parse(a):a}catch(c){}}var j=/\+/g,e=d.cookie=function(a,c,b){if(void 0!==c){b=d.extend({},e.defaults,b);if("number"===typeof b.expires){var g=b.expires,f=b.expires=new Date;f.setDate(f.getDate()+g)}c=e.json? 
-/** +JSON.stringify(c):String(c);return document.cookie=[e.raw?a:encodeURIComponent(a),"=",e.raw?c:encodeURIComponent(c),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join("")}c=e.raw?m:n;b=document.cookie.split("");for(var g=a?void 0:{},f=0,j=b.length;f<j;f++){var h=b[f].split("="),l=c(h.shift()),h=c(h.join("="));if(a&&a===l){g=k(h);break}a||(g[l]=k(h))}return g};e.defaults={};d.removeCookie=function(a,c){return void 0!== 
- * Create a cookie with the given name and value and other optional parameters. +d.cookie(a)?(d.cookie(a,"",d.extend({},c,{expires:-1})),!0):!1}});
- * +
- * @example $.cookie('the_cookie', 'the_value')+
- * @desc Set the value of a cookie. +
- * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com'securetrue })+
- * @desc Create cookie with all available options. +
- * @example $.cookie('the_cookie', 'the_value')+
- * @desc Create session cookie. +
- * @example $.cookie('the_cookie'null)+
- * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain +
-   used when the cookie was set. +
- * +
- * @param String name The name of the cookie. +
- * @param String value The value of the cookie. +
- * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. +
- * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. +
- * If a negative value is specified (e.g. date in the past), the cookie will be deleted. +
- * If set to null or omitted, the cookie will be session cookie and will not be retained +
- * when the the browser exits. +
- * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). +
- * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). +
- * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will +
- *require a secure protocol (like HTTPS). +
- * @type undefined +
- * +
- * @name $.cookie +
- * @cat Plugins/Cookie +
- * @author Klaus Hartl/klaus.hartl@stilbuero.de +
- */ +
-  +
-/** +
- * Get the value of a cookie with the given name. +
- * +
- * @example $.cookie('the_cookie')+
- * @desc Get the value of cookie. +
- * +
- * @param String name The name of the cookie. +
- * @return The value of the cookie. +
- * @type String +
- * +
- * @name $.cookie +
- * @cat Plugins/Cookie +
- * @author Klaus Hartl/klaus.hartl@stilbuero.de +
- */ +
-jQuery.cookie = function(namevalueoptions) { +
-if (typeof value != 'undefined') { // name and value given, set cookie +
-options options || {}; +
-if (value === null) { +
-value ''; +
-options.expires = -1; +
-+
-var expires = ''; +
-if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { +
-var date; +
-if (typeof options.expires == 'number'+
-date = new Date(); +
-date.setTime(date.getTime() (options.expires * 24 * 60 * 60 * 1000)); +
-} else { +
-date = options.expires; +
-+
-expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE +
-+
-// CAUTIONNeeded to parenthesize options.path and options.domain +
-// in the following expressionsotherwise they evaluate to undefined +
-// in the packed version for some reason... +
-var path = options.path ? '; path=(options.path''; +
-var domain = options.domain ? '; domain=(options.domain''; +
-var secure = options.secure ? '; secure''; +
-document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('')+
-else { // only name given, get cookie +
-var cookieValue null; +
-if (document.cookie && document.cookie != '') { +
-var cookies = document.cookie.split(';'); +
-for (var = 0; i < cookies.length; i++) { +
-var cookie jQuery.trim(cookies[i])+
-// Does this cookie string begin with the name we want? +
-if (cookie.substring(0name.length + 1) == (name + '=')) { +
-cookieValue decodeURIComponent(cookie.substring(name.length + 1))+
-break; +
-} +
-+
-+
-return cookieValue; +
-+
-};+
 </file> </file>
- 

Site Tools