(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?t(require("jquery")):t(jQuery)})(function(t){function i(t){return a.raw?t:encodeURIComponent(t)}function n(t){return a.raw?t:decodeURIComponent(t)}function e(t){return i(a.json?JSON.stringify(t):t+"")}function o(t){0===t.indexOf('"')&&(t=t.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return t=decodeURIComponent(t.replace(_," ")),a.json?JSON.parse(t):t}catch(i){}}function s(i,n){var e=a.raw?i:o(i);return t.isFunction(n)?n(e):e}var _=/\+/g,a=t.cookie=function(o,_,p){if(void 0!==_&&!t.isFunction(_)){if(p=t.extend({},a.defaults,p),"number"==typeof p.expires){var h=p.expires,c=p.expires=new Date;c.setTime(+c+864e5*h)}return document.cookie=[i(o),"=",e(_),p.expires?"; expires="+p.expires.toUTCString():"",p.path?"; path="+p.path:"",p.domain?"; domain="+p.domain:"",p.secure?"; secure":""].join("")}for(var r=o?void 0:{},l=document.cookie?document.cookie.split("; "):[],u=0,d=l.length;d>u;u++){var g=l[u].split("="),m=n(g.shift()),f=g.join("=");if(o&&o===m){r=s(f,_);break}o||void 0===(f=s(f))||(r[m]=f)}return r};a.defaults={},t.removeCookie=function(i,n){return void 0===t.cookie(i)?!1:(t.cookie(i,"",t.extend({},n,{expires:-1})),!t.cookie(i))}}); ;(function ($,window) { var interval = 200 , FALSE = !1 , CHILD = 'tr-child' , HEIGHT = 'tr-height' , TIMER = 'tr-timer'; var detect = function (element, child) { element.data(HEIGHT, child.height()); return function () { if (element.data(HEIGHT) !== child.height()) { element.data(HEIGHT, child.height()) .triggerHandler('textresize'); } }; }; $.event.special.textresize = { setup: function () { var element = $(this) , child = $(' ') .css({display:'inline',top:'-9999px',left:'-9999px',position:'absolute'}) .appendTo('#content') , timer = window.setInterval(detect(element, child), interval); element.data(CHILD, child) .data(TIMER, timer); return FALSE; }, teardown: function () { var element = $(this); window.clearInterval(element.data(TIMER)); element.data(CHILD).remove(); element.removeData(CHILD) .removeData(HEIGHT) .removeData(TIMER); return FALSE; } }; $.fn.textresize = function (fn) { $(this).bind('textresize', fn); return this; }; })(jQuery,window); /* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright (C) 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ (function(jQuery){ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { //alert(jQuery.easing.default); return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); })(jQuery); /* * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright (C) 2001 Robert Penner * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ /*! * imagesLoaded PACKAGED v3.1.8 * JavaScript is all like "You images are done yet or what?" * MIT License */ (function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s}); /** * jquery.matchHeight.js v0.5.2 * http://brm.io/jquery-match-height/ * License: MIT */ ;(function($) { /* * internal */ var _previousResizeWidth = -1, _updateTimeout = -1; /* * _rows * utility function returns array of jQuery selections representing each row * (as displayed after float wrapping applied by browser) */ var _rows = function(elements) { var tolerance = 1, $elements = $(elements), lastTop = null, rows = []; // group elements by their top position $elements.each(function(){ var $that = $(this), top = $that.offset().top - _parse($that.css('margin-top')), lastRow = rows.length > 0 ? rows[rows.length - 1] : null; if (lastRow === null) { // first item on the row, so just push it rows.push($that); } else { // if the row top is the same, add to the row group if (Math.floor(Math.abs(lastTop - top)) <= tolerance) { rows[rows.length - 1] = lastRow.add($that); } else { // otherwise start a new row group rows.push($that); } } // keep track of the last row top lastTop = top; }); return rows; }; /* * _parse * value parse utility function */ var _parse = function(value) { // parse value and convert NaN to 0 return parseFloat(value) || 0; }; /* * _parseOptions * handle plugin options */ var _parseOptions = function(options) { var opts = { byRow: true, remove: false, property: 'height' }; if (typeof options === 'object') { return $.extend(opts, options); } if (typeof options === 'boolean') { opts.byRow = options; } else if (options === 'remove') { opts.remove = true; } return opts; }; /* * matchHeight * plugin definition */ var matchHeight = $.fn.matchHeight = function(options) { var opts = _parseOptions(options); // handle remove if (opts.remove) { var that = this; // remove fixed height from all selected elements this.css(opts.property, ''); // remove selected elements from all groups $.each(matchHeight._groups, function(key, group) { group.elements = group.elements.not(that); }); // TODO: cleanup empty groups return this; } if (this.length <= 1) return this; // keep track of this group so we can re-apply later on load and resize events matchHeight._groups.push({ elements: this, options: opts }); // match each element's height to the tallest element in the selection matchHeight._apply(this, opts); return this; }; /* * plugin global options */ matchHeight._groups = []; matchHeight._throttle = 80; matchHeight._maintainScroll = false; matchHeight._beforeUpdate = null; matchHeight._afterUpdate = null; /* * matchHeight._apply * apply matchHeight to given elements */ matchHeight._apply = function(elements, options) { var opts = _parseOptions(options), $elements = $(elements), rows = [$elements]; // take note of scroll position var scrollTop = $(window).scrollTop(), htmlHeight = $('html').outerHeight(true); // get hidden parents var $hiddenParents = $elements.parents().filter(':hidden'); // cache the original inline style $hiddenParents.each(function() { var $that = $(this); $that.data('style-cache', $that.attr('style')); }); // temporarily must force hidden parents visible $hiddenParents.css('display', 'block'); // get rows if using byRow, otherwise assume one row if (opts.byRow) { // must first force an arbitrary equal height so floating elements break evenly $elements.each(function() { var $that = $(this), display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block'; // cache the original inline style $that.data('style-cache', $that.attr('style')); $that.css({ 'display': display, 'padding-top': '0', 'padding-bottom': '0', 'margin-top': '0', 'margin-bottom': '0', 'border-top-width': '0', 'border-bottom-width': '0', 'height': '100px' }); }); // get the array of rows (based on element top position) rows = _rows($elements); // revert original inline styles $elements.each(function() { var $that = $(this); $that.attr('style', $that.data('style-cache') || ''); }); } $.each(rows, function(key, row) { var $row = $(row), maxHeight = 0; // skip apply to rows with only one item if (opts.byRow && $row.length <= 1) { $row.css(opts.property, ''); return; } // iterate the row and find the max height $row.each(function(){ var $that = $(this), display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block'; // ensure we get the correct actual height (and not a previously set height value) var css = { 'display': display }; css[opts.property] = ''; $that.css(css); // find the max height (including padding, but not margin) if ($that.outerHeight(false) > maxHeight) maxHeight = $that.outerHeight(false); // revert display block $that.css('display', ''); }); // iterate the row and apply the height to all elements $row.each(function(){ var $that = $(this), verticalPadding = 0; // handle padding and border correctly (required when not using border-box) if ($that.css('box-sizing') !== 'border-box') { verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width')); verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom')); } // set the height (accounting for padding and border) $that.css(opts.property, maxHeight - verticalPadding); }); }); // revert hidden parents $hiddenParents.each(function() { var $that = $(this); $that.attr('style', $that.data('style-cache') || null); }); // restore scroll position if enabled if (matchHeight._maintainScroll) $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true)); return this; }; /* * matchHeight._applyDataApi * applies matchHeight to all elements with a data-match-height attribute */ matchHeight._applyDataApi = function() { var groups = {}; // generate groups by their groupId set by elements using data-match-height $('[data-match-height], [data-mh]').each(function() { var $this = $(this), groupId = $this.attr('data-match-height') || $this.attr('data-mh'); if (groupId in groups) { groups[groupId] = groups[groupId].add($this); } else { groups[groupId] = $this; } }); // apply matchHeight to each group $.each(groups, function() { this.matchHeight(true); }); }; /* * matchHeight._update * updates matchHeight on all current groups with their correct options */ var _update = function(event) { if (matchHeight._beforeUpdate) matchHeight._beforeUpdate(event, matchHeight._groups); $.each(matchHeight._groups, function() { matchHeight._apply(this.elements, this.options); }); if (matchHeight._afterUpdate) matchHeight._afterUpdate(event, matchHeight._groups); }; matchHeight._update = function(throttle, event) { // prevent update if fired from a resize event // where the viewport width hasn't actually changed // fixes an event looping bug in IE8 if (event && event.type === 'resize') { var windowWidth = $(window).width(); if (windowWidth === _previousResizeWidth) return; _previousResizeWidth = windowWidth; } // throttle updates if (!throttle) { _update(event); } else if (_updateTimeout === -1) { _updateTimeout = setTimeout(function() { _update(event); _updateTimeout = -1; }, matchHeight._throttle); } }; /* * bind events */ // apply on DOM ready event $(matchHeight._applyDataApi); // update heights on load and resize events $(window).bind('load', function(event) { matchHeight._update(false, event); }); // throttled update heights on resize events $(window).bind('resize orientationchange', function(event) { matchHeight._update(true, event); }); })(jQuery); /* * jQuery hashchange event - v1.3 - 7/21/2010 * http://benalman.com/projects/jquery-hashchange-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$(''; } else if ($this.hasClass('js-iframe2') ){ modalTransition($this); }else{ $modalCont.url = $this.data('url'); } modalBoxPosTop = $window.scrollTop(); // modalコンテンツをセット $($modalBox).find('.movie-box').html($modalCont.url); if(!$($modalBox).hasClass('open')){ $($modalBox).imagesLoaded( function() { closeFlg = false; modalOpen($this); }); } }; // モーダル内遷移 var modalTransition = function($this) { var bkUr,bkTx,bkTxNum,hash,num,url; if($('iframe',parent.document)[0] !== undefined){ // if(ua.uaObj.uaDevice === 'device-mobile'){ // url = $this[0].getAttribute('data-url'); // }else{ // url = $this[0].getAttribute('data-url').split('#').shift(); // } // $('iframe',parent.document).attr('src', url); }else{ $($modalBox).attr('src', $this.data('url')); } }; var modalOpen = function(tag){ var v = 1; $overlay.height( $(document).height() ).stop().fadeIn(options.duration, options.easing); winH = Window.viewport().height; winW = Window.viewport().width; modalHeight = $($modalBox).outerHeight(); modalTopMargin = ( winH - modalHeight + 15 ) / 2; if(tag.hasClass('js-iframe') ){ $('iframe').load(function(){ if (typeof $(this).attr('height') == 'undefined') { modalHeight = this.contentWindow.document.documentElement.scrollHeight+10; } if(ua.uaObj.uaDevice === 'device-mobile' ) { addressSpSetsize(tag); } }); } if(modalHeight > winH){ modalTopM = modalBoxPosTop + 100; } else{ modalTopM = modalBoxPosTop + modalTopMargin + 80; } modalLeft = $($modalBox).outerWidth()/2; clearTimeout(clear); // $($modalBox).css({ 'top' : modalTopM, 'marginLeft' : -modalLeft }); $($modalBox).css({ 'top' : modalTopM, 'left':0, 'right':0, 'margin':'auto' }); $($modalBox).stop(true, true).show(); if( userAgent.indexOf('android') > 0){ androidSetModal(); } function androidSetModal(){ var w = Window.viewport().width - 40; $($modalBox).width(w); } setTimeout(function(){ $($modalBox).addClass('open'); $('#overlay, .modal-close').on('click', function(){ modalClose(); }); }, 200); }; var addressSpSetsize = function(tag) { var v = 1; modalTopMargin = modalTopM = 50; if(tag.hasClass('js-iframe4')) { v = 0.65; //modalサイズの倍率変更 modalTopM = (winH * 0.5) - (winH * v) / 2; } modalHeight = winH * v - modalTopMargin; $('html').css({'overflow':'hidden','width': 'auto'}); $('body').css({'position':'fixed','height': winH, 'width': '100%'}); $('iframe').contents().find('html,body').css({'height':'100%', 'overflow': 'auto','-webkit-overflow-scrolling': 'touch' }); $($modalBox).find('.movie-box').css({'height':'100%','padding-top':0}); $($modalBox).css({'height':modalHeight, 'top' : modalTopM}); $(window).on('resize', function(){ if( $($modalBox).hasClass('open')) addressSpSetsize(tag); }) }; var modalClose = function(){ $($modalBox).removeClass('open select2'); $overlay.stop().fadeOut(options.duration, options.easing,function(){ $('html,body').removeAttr('style'); }); clear = setTimeout(function(){ $($modalBox).stop(true, true).hide(); $($modalBox).css({ 'top' : 0 , 'height': 'auto'} ); $($modalBox).find('.movie-box').html(''); }, 500); }; init(); }); }; modalWindow(); // ---------------------------------------------------------------------------- // Tab Navigation // ---------------------------------------------------------------------------- $(function(){ if($('.js-nav-tab-01')[0] !== undefined) return; var KF = KF || {}; KF.Fncs = {}; KF.Run = {}; KF.Fncs.Tab = function(options){ this.tab = options.tabName; this.btn = options.btnName; this.content = options.contentsName; this.inner = options.contentsInner; this.type = options.btnType; this.memory = options.memory; this.history = options.history; this.animation = options.animation; this.speed = options.animationSpeed; this.gorvernmentLinkText = options.gorvernmentLinkText; this.$sortListLink = options.$sortListLink; this.hashVal = null; this.stayBtn = {}; this.stayContents = {}; this.tabInner = {}; this.stayImg = {}; this.animeFinish = false; if(this.history ){ $(window).hashchange(); } }; KF.Fncs.Tab.prototype = { getHash : function(tab){ var btn = this.btn, content = this.content, index = 0, id_name, that = this, i; var tabId = $.cookie('tabId'); if(tabId === ''){ return 0; } // var hash = location.hash.replace(/#first/,''); var hash = tabId;//location.hash.replace(/#/,''); // if( hash.match(/^\js\-/) ){ // hash = hash.replace(/^\js\-/,''); // } if(hash === undefined){ return 0; } tab.find(content).each(function(i){ id_name = this.getAttribute('id'); if(hash === id_name){ index = i; } }); return index; }, getCookie : function(id){ var cookie = $.cookie(id); if(!cookie){ return 0; }else{ return cookie; } }, setCookie : function(id,index){ $.cookie(id, index, { expires: 365 }); }, hashChecker : function(){ var tab = this.tab, btn = this.btn, content = this.content, inner = this.inner, type = this.type, that = this; $(window).hashchange(function(){ var timer = setInterval(function(){ if (!that.animeFinish) { clearInterval(timer); var hash = location.hash; if (hash === '') { return false; } if (that.hashVal !== hash) { that.hashVal = hash.replace(/#history-/, ''); $(tab).each(function(i){ var container = $(this); container.find(content).each(function(j){ if ($(this).attr('id') === that.hashVal) { that.stayBtn[i].removeClass('active'); that.stayContents[i].removeClass('active'); that.tabInner[i].removeAttr('style'); that.stayBtn[i] = $($(container.find(btn).get(0)).children().get(j)); that.stayContents[i] = $(container.find(content).get(j)); that.tabInner[i] = $(that.stayContents[i].find(inner).get(j)); that.stayBtn[i].addClass('active'); that.stayContents[i].addClass('active'); if (type === 'image') { that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/_o/, "")); that.stayImg[i] = $(that.stayBtn[i].find('img').get(0)); that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/(\.[^\.]+$)/, "_o$1")); } } }); }); } } },1000); }); }, runTab : function(){ var tab = this.tab, btn = this.btn, content = this.content, inner = this.inner, type = this.type, memory = this.memory, history = this.history, animation = this.animation, speed = this.speed, that = this; $(content).css({'opacity':0}); $(tab).each(function(i){ var id_name = this.getAttribute('id'), stay_num = that.getHash($(this)), contents = $(this).find(content), btns = $($(this).find(btn).get(0)).children(), flgHash = location.hash, stay_image,posTop; if(flgHash === '#tab2-02'){ posTop = $('.nav-tab-01').get(0).offsetTop; $('html,body').stop().animate({'scrollTop':posTop},1); } if(flgHash !== '' && $('.js-not-hash-accordion, .js-hash-scroll').length > 0 ){ $(window).on('load',function(){ posTop = $('.js-not-hash-accordion').get(0) !== undefined ? $('.js-not-hash-accordion').get(0).offsetTop : $('.js-hash-scroll').get(0).offsetTop ; $('html,body').animate({'scrollTop': posTop},1); }); } if(id_name && memory){ stay_num = that.getCookie(id_name); } if(history){ location.href = btns.find('a').get(stay_num).getAttribute('href',2).replace(/#/,'#history-'); } that.stayBtn[i] = $($(btns).get(stay_num)), that.stayContents[i] = $($(contents).get(stay_num)), that.tabInner[i] = $(that.stayContents[i].find(inner).get(stay_num)); if(!$(this).hasClass('active')) $(this).addClass('active'); that.stayBtn[i].addClass('active'); that.stayContents[i].addClass('active'); $(content).removeAttr('style'); if(type === 'image'){ that.stayImg[i] = $(that.stayBtn[i].find('img').get(0)); that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/(\.[^\.]+$)/, "_c$1")); $(btns).mouseover(function(){ if(!$(this).is('.active')){ var img = $(this).find('img'); img.attr('src', img.attr('src').replace(/(\.[^\.]+$)/, "_o$1")); } }); $(btns).mouseout(function(){ if (!$(this).is('.active')) { var img = $(this).find('img'); img.attr('src', img.attr('src').replace(/_o/, "")); } }); } if (history) { that.hashChecker(); } $('.js-tab-move').click(function(){ var index = btns.index(this), btn = $(this), tab_height; that.tabInner[i].removeAttr('style'); if($(this).is('.active')){ return false; } if(that.$sortListLink){ that.$sortListLink.find('span').text(that.gorvernmentLinkText); if($(this).text() === '地域から探す'){ that.$sortListLink.attr('href','/ytc/government/case/#tab2-02'); } if($(this).text() === '課題から探す'){ that.$sortListLink.attr('href','/ytc/government/case/'); } } if(memory){ that.setCookie(id_name,index); } that.stayBtn[i].removeClass('active'); that.stayContents[i].removeClass('active'); that.tabInner[i].removeAttr('style'); that.tabInner[i].stop(); that.stayBtn[i] = $($(btns).get(index)); that.stayContents[i] = $($(contents).get(index)); that.tabInner[i] = $(that.stayContents[i].find(inner).get(0)); if (type === 'image') { that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/_o/, "")); that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/_c/, "")); that.stayImg[i] = $($(this).find('img').get(0)); that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/_o/, "_c")); } if(animation.fade || animation.slide){ that.stayBtn[i].addClass('active'); that.stayContents[i].addClass('active').removeAttr('style'); if(animation.fade === true && animation.slide === false){ that.tabInner[i].css({ 'opacity' : '0' }); that.animeFinish = true; that.tabInner[i].animate({ 'opacity': '1' }, { 'duration': speed, 'easing': "linear", complete: function(){ that.animeFinish = false; } }, false); }else if(animation.fade === false && animation.slide === true){ tab_height = that.tabInner[i].height(); that.tabInner[i].css({ 'height' : '0' }); that.animeFinish = true; that.tabInner[i].animate({ 'height' : tab_height }, { duration: speed, easing: "linear", complete: function(){ that.tabInner[i].css({ 'height' : 'auto' }); that.animeFinish = false; } }, false); }else if(animation.fade === true && animation.slide === true){ tab_height = that.tabInner[i].height(); that.tabInner[i].css({ 'opacity' : '0', 'height' : '0' }); that.animeFinish = true; that.tabInner[i].animate({ 'opacity': '1', 'height':tab_height }, { 'duration': speed, 'easing': "linear", complete: function(){ that.tabInner[i].css({ 'height' : 'auto' }); that.animeFinish = false; } }, false); } }else{ that.stayBtn[i].addClass('active'); that.stayContents[i].addClass('active'); } if(history){ location.hash = btn.find('a').get(0).getAttribute('href',2).replace(/#/,'#history-'); } return false; }); $(btns).click(function(){ var index = btns.index(this), btn = $(this), tab_height; that.tabInner[i].removeAttr('style'); if($(this).is('.active')){ return false; } if(that.$sortListLink){ that.$sortListLink.find('span').text(that.gorvernmentLinkText); if($(this).text() === '地域から探す'){ that.$sortListLink.attr('href','/ytc/government/case/#tab2-02'); } if($(this).text() === '課題から探す'){ that.$sortListLink.attr('href','/ytc/government/case/'); } } if(memory){ that.setCookie(id_name,index); } that.stayBtn[i].removeClass('active'); that.stayContents[i].removeClass('active'); that.tabInner[i].removeAttr('style'); that.tabInner[i].stop(); that.stayBtn[i] = $($(btns).get(index)); that.stayContents[i] = $($(contents).get(index)); that.tabInner[i] = $(that.stayContents[i].find(inner).get(0)); if (type === 'image') { that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/_o/, "")); that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/_c/, "")); that.stayImg[i] = $($(this).find('img').get(0)); that.stayImg[i].attr('src', that.stayImg[i].attr('src').replace(/_o/, "_c")); } if(animation.fade || animation.slide){ that.stayBtn[i].addClass('active'); that.stayContents[i].addClass('active').removeAttr('style'); if(animation.fade === true && animation.slide === false){ that.tabInner[i].css({ 'opacity' : '0' }); that.animeFinish = true; that.tabInner[i].animate({ 'opacity': '1' }, { 'duration': speed, 'easing': "linear", complete: function(){ that.animeFinish = false; } }, false); }else if(animation.fade === false && animation.slide === true){ tab_height = that.tabInner[i].height(); that.tabInner[i].css({ 'height' : '0' }); that.animeFinish = true; that.tabInner[i].animate({ 'height' : tab_height }, { duration: speed, easing: "linear", complete: function(){ that.tabInner[i].css({ 'height' : 'auto' }); that.animeFinish = false; } }, false); }else if(animation.fade === true && animation.slide === true){ tab_height = that.tabInner[i].height(); that.tabInner[i].css({ 'opacity' : '0', 'height' : '0' }); that.animeFinish = true; that.tabInner[i].animate({ 'opacity': '1', 'height':tab_height }, { 'duration': speed, 'easing': "linear", complete: function(){ that.tabInner[i].css({ 'height' : 'auto' }); that.animeFinish = false; } }, false); } }else{ that.stayBtn[i].addClass('active'); that.stayContents[i].addClass('active'); } if(history){ location.hash = btn.find('a').get(0).getAttribute('href',2).replace(/#/,'#history-'); } return false; }); }); } }; KF.Run.Tab = function(options){ var ins_tab = new KF.Fncs.Tab(options); ins_tab.runTab(); }; KF.Run.Tab({ tabName : '.nav-tab-01', btnName : '.tab-btns', contentsName : '.tab-contents', contentsInner : '.tab-inner', memory : false, history : false, animation : {fade : true , slide : false}, animationSpeed : 200, gorvernmentLinkText: '取り組み事例一覧を見る', $sortListLink : $('#js-sort-list-link') || false, }); $('.js-tab-page-top').on('click', function(e){ $('body,html').animate({scrollTop: 0},100); return false; }); }); // 集荷依頼 $(function() { var speed = 400; var href,index; var Tab = function(el) { this.$el = el; this.$btnWrap = this.$el.children('.js-nab-btn').find('.tab-btns')[0] !== undefined ? this.$el.children('.js-nab-btn').find('.tab-btns') : this.$el.children('.tab-btns'); this.$cont = this.$el.children('.tab-contents'); this.$btn = this.$btnWrap.find('li')[0] !== undefined ? this.$btnWrap.find('li') : this.$btnWrap.find('input'); this.init(); }; Tab.prototype.init = function() { this.$cont.css({'display':'none'}); this.controller(); }; Tab.prototype.controller = function() { var _this = this; this.$btn.on('click', function() { index = $(this).index(); if(_this.$btnWrap.find('li')[0] !== undefined) { _this.changeTab($(this)); _this.setNav(); } if(_this.$btnWrap.find('p')[0] !== undefined) { _this.setNav2(); _this.changeTab2(); } }); }; Tab.prototype.setNav = function() { this.$btn.css({'dispaly':'none'}); this.$btnWrap.each(function(i){ var nav = $(this).find('li'); nav.eq(index).css({'display': 'block'}); }); }; Tab.prototype.changeTab = function() { this.$cont.css({'display': 'none'}); this.$cont.eq(index).css({'display': 'block'}); $(this.$cont[index]).find('.js-tab-inner').css({'opacity':0}); $(this.$cont[index]).find('.js-tab-inner').animate({ 'opacity': '1' }, { 'duration': speed, 'easing': 'linear' }, false); }; Tab.prototype.setNav2 = function() { $(this.$btn[index]).toggleClass('active'); }; Tab.prototype.changeTab2 = function(t) { $(this.$cont[index]).toggleClass('active'); $('.js-set-height').matchHeight(); $('.lyt-column-01 .column').matchHeight(); }; if($('.js-nav-tab-01')[0] !== undefined) var tab = new Tab($('.js-nav-tab-01')); if($('.js-nav-tab-02')[0] !== undefined) var tab2 = new Tab($('.js-nav-tab-02')); }); // ---------------------------------------------------------------------------- // SP Telephone Action Call // ---------------------------------------------------------------------------- $(function(){ if ( ua.uaObj.uaDevice === 'device-mobile' ){ $('span[data-action=call]').each(function() { var $elm = $(this); $elm.wrap(''); }); } }); // ---------------------------------------------------------------------------- // Page Top // ---------------------------------------------------------------------------- $(function(){ var pageTop = function() { var y,winW,posr, num = 50, tabBreak = 1064, spBreak = 760, flg = false, $el = $('#nav-page-top-01') || undefined; function init() { $(window).on('load', function(){ winW = $(window).width(); y = window.pageYOffset; setSize(); resize(); onload(); if(ua.uaObj.uaDevice === 'ipad') { $el.addClass('not-animation'); } }); $(window).on('scroll', function() { y = window.pageYOffset; onload(); }); } function onload() { if(num 1) { event.preventDefault(); } }, true); // iOS10のSafariでuser-scalable=no が効かなくズームが出来る問題への対策(ダブルタップを防ぐ) var lastTouchEnd = 0; document.documentElement.addEventListener('touchend', function (event) { var now = (new Date()).getTime(); if (now - lastTouchEnd <= 500) { event.preventDefault(); } lastTouchEnd = now; }, true); } bugFix(); }); $(function(){ var flg = true; var tailFlg = true; var tabFlg = true; var bkPoint = 1064; var bkSp = 760; var overValFlg = false; var maxCartHeight = 280; var maxValSet = 0; var ItemArray = []; // implemented in side on the system var setVal,itemlen,winW,winH; //maxVal; var BoxOrder = function(el, intA){ if (typeof BoxOrder.instance === 'object'){ return BoxOrder.instance; } // implemented in side on the system // maxVal = int || 30; this.$itemElm = el || $(window); this.$totalElm = $('.js-total-cart') || ''; this.$translationCart = $('.js-translation-cart') || ''; var totalPriceElm = this.$totalElm.find('.js-total-price'); this.totalPrice = totalPriceElm[0] ? parseInt( totalPriceElm.text().replace(/,/g, ''), 10 ) : 0; this.form = document.forms; this.init(); BoxOrder.instance = this; return this; }; BoxOrder.prototype.init = function(){ var _this = this; this.$outerElm = $('.box-order-content-01-container') || ''; this.$innerElm = this.$totalElm.find('.inner') || ''; this.$navBtn = $('.js-nav-slide') || ''; this.$cartOffset = $('#main').offset() || 0; this.$totalItemList = this.$totalElm.find('.total-item-list') || ''; this.$allViewBtn = this.$totalElm.find('.js-all-view') || ''; if (this.$totalElm.find('.total-item-list')[0] !== undefined) setVal = 0; if (this.$itemElm.find('.js-sub-total-price')[0] !== undefined) setVal = 1; $('form').attr('autocomplete', 'off'); window.addEventListener('load', function(){ $('form').attr('autocomplete', 'off'); winW = Window.viewport().width; winH = Window.viewport().height; if (bkPoint <= winW){ tabFlg = true; } else { tabFlg = false; } _this.setElm(); _this.cartHeight(); }, false); window.addEventListener('resize', function(){ winW = Window.viewport().width; winH = Window.viewport().height; _this.cartHeight(); }, false); this.initData(); this.setData(true); this.controller(); }; BoxOrder.prototype.initData = function(){ var _this = this; this.initDataArr = []; this.$totalItemList.find('dl').each(function() { var intA = parseInt( $(this).find('.item-count').text(), 10); var price = $(this).find('.subtotal').text(); var name = $(this).find('.js-item-name').text(); var obj = { goodsKey: $(this).find('.js-item-name').data('goodskey'), intA: intA, price: price, name: name }; _this.initDataArr.push(obj); }); }; BoxOrder.prototype.controller = function(){ var _this = this; var $minusBtn = this.$itemElm.find('.js-item-minus') || ''; var $plusBtn = this.$itemElm.find('.js-item-plus') || ''; var $delBtn = this.$itemElm.find('.js-del-btn') || ''; var maxPrice = 1000000; this.$navBtn.find('.title').on('click', function(e) { if(winW >= bkPoint) { e.preventDefault(); } }); $plusBtn.on('click', function(){ var maxVal = $(this).closest('.item-tools-box').find('.js-item-total').data('max'); var price = parseInt( $(this).closest('dl').find('.price').text().replace(/,/g, ''), 10); var totalPrice = parseInt( _this.totalPrice.replace(/,/g, ''), 10); if(price > maxPrice || price + totalPrice > maxPrice) return; if (maxVal === 10 && maxVal <= maxValSet) return true; if ($(this).prev().children()[0].value >= maxVal) return true; // 英数字以外が入力されていたら if ($(this).prev().children()[0].value.match(/[^0-9]+/)){ $(this).prev().children()[0].value = 0; } $(this).prev().children()[0].value++; overValFlg = false; _this.overValError(this); _this.setData(false, this); _this.TotalCartModel(this); if (tailFlg === true){ _this.tailAnimation(); } }); $minusBtn.on('click', function(){ // implemented in side on the system var $itemTotal = $(this).closest('.item-tools-box').find('.js-item-total'); var maxVal = $itemTotal.data('max'); var minVal = $itemTotal.data('min'); if ($(this).next().children()[0].value <= minVal) return true; if ($(this).next().children()[0].value <= 0) return true; if ($(this).next().children()[0].value > maxVal) $(this).next().children()[0].value = maxVal++; // 英数字以外が入力されていたら if ($(this).next().children()[0].value.match(/[^0-9]+/)){ $(this).next().children()[0].value = minVal; } $(this).next().children()[0].value--; overValFlg = false; _this.overValError(this); _this.setData(false, this); _this.TotalCartModel(this); if (tailFlg === true){ _this.tailAnimation(); } }); this.$allViewBtn.on('click', function(){ _this.TotalCartModel(this); }); $delBtn.on('click', function(){ // implemented in side on the system $(document).trigger('custom.removeCartInfo', $(this).closest('.item-list')); $(this).closest('dl').find('.js-item-total')[0].value = 0; $(this).closest('.item-list').remove(); // 要素が0になったら空の表示に切り替え if (_this.$itemElm.find('.item-list').length === 0){ _this.$totalElm.css({'display':'none'}); _this.$itemElm.find('.box-content-01').css({'display':'block'}); } _this.setData(false, this); }); $('.js-item-total').each(function(){ $(this).on('keyup focus', changeEvt(this)); }); // key入力時の function changeEvt(e){ var old = e.value; var v, str, othverVal, maxVal2,totalPrice; var price = parseInt( $(e).closest('dl').find('.price').text().replace(/,/g, ''), 10); return function(){ // implemented in side on the system var maxVal = $(this).data('max'); var minVal = $(this).data('min'); totalPrice = parseInt( _this.totalPrice.replace(/,/g, ''), 10); v = e.value; str = e.value; // 全角数字は半角数字へ変換, 数字以外の文字列は削除 // old = parseInt(old, 10); str = parseInt( str.replace(/[0-9.]/g, function(s){ return String.fromCharCode(s.charCodeAt(0) - 65248); }) .replace(/[^0-9]+/, '').replace('', '0'), 10); // implemented in side on the system if (parseInt(str, 10) === 0) { str = minVal; } // 合計値のでの制限 maxValCheck(maxVal); $(e).on('blur', function(){ // implemented in side on the system var maxVal = $(this).data('max'); var minVal = $(this).data('min'); if (e.value.match(/[^0-9]/g)){ $(e).val(minVal); } // 桁数制限 if(price > maxPrice || price * e.value + (totalPrice - price * old) > maxPrice ){ $(e).val(old); // if (maxVal === 10){ // _this.totalValLimit(); // othverVal = maxValSet - parseInt(str, 10) > 0 ? // maxValSet - parseInt(str, 10) : 0; // maxVal2 = maxVal - othverVal; // if (maxValSet > maxVal || othverVal + parseInt(old, 10) > maxVal){ // overValFlg = true; // } else { // overValFlg = false; // } // _this.overValError(e); // // 各要素での制限 // } else { if (old > maxVal){ overValFlg = true; }else{ overValFlg = false; } _this.overValError(e); // } _this.setData(false, this); } if (parseInt(e.value, 10) > maxVal){ if (maxVal === 10){ $(e).val(maxVal2); overValFlg = true; } else { overValFlg = true; $(e).val(maxVal); } _this.overValError(e); _this.setData(false, this); } old = str; }); // console.log(str); // console.log(price * str); // console.log((totalPrice - price * old)); if(price > maxPrice || price * str + (totalPrice - price * old) > maxPrice ){ str = old; maxValCheck(maxVal); } $(this).val(parseInt(str, 10)); if (old != v){ old = str; _this.setData(false, this); } }; function maxValCheck(maxVal) { // if (maxVal === 10){ // _this.totalValLimit(); // othverVal = maxValSet - parseInt(str, 10) > 0 ? // maxValSet - parseInt(str, 10) : 0; // maxVal2 = maxVal - othverVal; // if (maxValSet > maxVal || othverVal + parseInt(old, 10) > maxVal){ // str = maxVal2; // overValFlg = true; // } else { // overValFlg = false; // } // _this.overValError(e); // // 各要素での制限 // } else { if (str > maxVal || old > maxVal){ str = maxVal; overValFlg = true; }else{ overValFlg = false; } _this.overValError(e); // } } } $(window).on({ 'scroll resize': function(){ _this.translationCart(); }, 'load': function(){ _this.$cartOffset = $('#main').offset() || 0; _this.translationCart(); } }); }; BoxOrder.prototype.TotalCartModel = function(t){ var outerHeight = this.$totalElm.find('.total-item-list').outerHeight() || 0; // 全て見るボタンが押された処理 if ($(t).hasClass('js-all-view')){ if (outerHeight >= maxCartHeight && winW >= bkPoint) this.allview(); } }; // 個数入力時のエラー BoxOrder.prototype.overValError = function(el){ // implemented in side on the system var maxVal = $(el).data('max'); var text = 'この梱包資材は
' + maxVal + '個以内で'; var _this = this; // var text = maxVal > 10 ? '1つの包装資材につき
30個以内で' : '合計が10個以内になるように
'; var html = '

' + text + '入力してください

'; $('.item-tools-box').removeClass('error-val').find('.over-val-box').remove(); if (overValFlg){ if ( !$(el).closest('.item-tools-box').hasClass('error-val') ) $(el).closest('.item-tools-box').addClass('error-val'); $(el).closest('.item-tools-box').prepend(html); $(window).on('resize', function(){ if ($(window).innerWidth() <= bkSp){ setSize(); } else { _this.$itemElm.find('.over-val-box').removeAttr('style'); _this.$itemElm.find('.over-val-box span').removeAttr('style'); } }); } else { $(el).closest('.item-tools-box').removeClass('error-val').find('.over-val-box').remove(); } $(el).on('blur', function(){ $(this).closest('.item-tools-box').removeClass('error-val').find('.over-val-box').remove(); }); function setSize(){ var w, posL; // market02_kuronekobox.html if (_this.$itemElm.find('.box-order-item-list-01.type-01 .item-tools')[0] !== undefined){ w = _this.$itemElm.find('.box-order-item-list-01.type-01 .item-tools').innerWidth() - 30; posL = (_this.$itemElm.find('.item-tools-box').width() / 2) - 7; _this.$itemElm.find('.over-val-box span').css({ 'right': posL }); } else { w = _this.$itemElm.outerWidth() - 44; posL = _this.$itemElm.find('.img').innerWidth() - 22 + (_this.$itemElm.find('.item-tools-box').width() / 2) + 10; _this.$itemElm.find('.over-val-box span').css({ 'left': posL }); } _this.$itemElm.find('.over-val-box').width(w); } }; // 個数の合計値を計算 BoxOrder.prototype.totalValLimit = function(){ maxValSet = 0; this.$itemElm.find('.js-item-total').each(function(){ maxValSet += parseInt($(this).val(), 10); }); }; BoxOrder.prototype.tailAnimation = function(){ var $tail = this.$totalElm.find('.tail'); tailFlg = false; $tail.addClass('on'); setTimeout(function(){ $tail.removeClass('on'); tailFlg = true; }, 1100); }; // 追従カート BoxOrder.prototype.translationCart = function(){ var _this = this; var defaultTop = 13; var topPadding = 60; var dSpeed = 100; var fixedNav = $('.nav-anchor-02.fixed').outerHeight() || 0; var winScroll = $(window).scrollTop() - (_this.$cartOffset.top); var elmH = _this.$translationCart.outerHeight(); var contentH = $('#main').innerHeight(); if (this.$translationCart[0] === undefined) return; if (winW <= bkPoint) return; if (!flg){ _this.$translationCart.stop(true, true).animate({ marginTop: defaultTop }, 500); return; } if (parseInt(this.$translationCart.css('margin-top').replace('px', ''), 10) === Math.round(winScroll + topPadding + fixedNav)) return; if (winScroll > 0 && winScroll + elmH + fixedNav + topPadding < contentH){ _this.$translationCart.stop(true, true).delay(dSpeed).animate({ marginTop: winScroll + topPadding + fixedNav }); // 通常の追従 // 734 806 } else if (winScroll <= _this.$cartOffset.top){ if (contentH <= winScroll + elmH + topPadding + defaultTop + fixedNav){ // 下部固定 _this.$translationCart.stop(true, true).delay(dSpeed).animate({ marginTop: contentH - elmH }); } else { // 上部固定 _this.$translationCart.stop(true, true).delay(dSpeed).animate({ marginTop: defaultTop }); } } else { _this.$translationCart.stop(true, true).delay(dSpeed).animate({ marginTop: contentH - elmH }); } }; // tabサイズ時のカートの高さをセット BoxOrder.prototype.cartHeight = function(){ var h = this.$totalElm.outerHeight(); if(winW <= bkPoint) { this.$navBtn.find('.title h2').text('注文確認'); }else{ this.$navBtn.find('.title h2').text('ご注文内容'); } // if (winH <= h && winW <= bkPoint && tabFlg){ // $('html, body').css({ 'overflow': 'hidden' }); // this.$outerElm.css({ 'height': winH, 'overflow-y': 'scroll' }); // tabFlg = false; // } else { // if (tabFlg) return; // $('html,body').removeAttr('style'); // this.$outerElm.removeAttr('style'); // tabFlg = true; // } }; // 合計金額を振り分けてセット BoxOrder.prototype.setElm = function(){ var _this = this; var html = _this.$totalElm.find('.js-price-total'); if (winW > bkPoint){ _this.$totalElm.find('.inner').prepend(html); } else { _this.$totalElm.find('.title-box').append(html); } window.addEventListener('resize', function(){ if (winW > bkPoint){ if (_this.$totalElm.find('.inner>.js-price-total').size() === 0){ html = _this.$totalElm.find('.js-price-total'); _this.$totalElm.find('.js-price-total').remove(); _this.$outerElm.removeAttr('style'); _this.$totalElm.find('.inner').prepend(html).removeAttr('style'); } } else { if (_this.$totalElm.find('.title-box>.js-price-total').size() === 0){ html = _this.$totalElm.find('.js-price-total'); _this.$outerElm.removeAttr('style'); _this.$totalElm.find('.js-price-total').remove(); _this.$totalElm.find('.title-box').append(html); } } }, false); }; // 選択した要素の小計を変更 BoxOrder.prototype.setData = function(b, t){ var _this = this; var bool = b; var bool2 = true var obj = {}; var initDataLen = this.initDataArr.length; var ItemArrayLen = ItemArray.length; var name, intA, price; if (this.$itemElm.hasClass('js-form-item-list-02')) this.totalValLimit(); // 初期値をセット if (bool){ for(var i=0; i 0){ for (var j = 0; ItemArray.length > j; j++){ if (ItemArray[j].name === name && ItemArray[j].intA !== intA){ this.totalPrice -= parseInt(ItemArray[j].price.replace(/,/g, ''), 10); ItemArray.splice(j, 1); } else if(ItemArray[j].name === name && ItemArray[j].intA === intA) { bool2 = false; } } } if(bool2) { this.totalPrice += parseInt(price.replace(/,/g, ''), 10); } if (intA > 0 && bool2) { ItemArray.unshift(obj); } } this.$totalElm.find('.total-item-list dl').remove(); }else{ if(!bool){ this.totalPrice = 0; this.$itemElm.find('.price').each(function(i){ intA = _this.$itemElm.find('.js-item-total')[i].value ? _this.$itemElm.find('.js-item-total')[i].value : _this.$itemElm.find('.js-item-total')[i].innerText; intA = parseInt(intA, 10); // int = parseInt(_this.$itemElm.find('.js-item-total')[i].value, 10); price = separate(parseInt($(this)[0].innerHTML.replace(/,/g, '')) * intA, 10); name = _this.$itemElm.find('.js-item-name')[i].innerText; $(this).closest('dl').find('.js-sub-total-price')[0].innerText = price; _this.totalPrice += parseInt($(this)[0].innerHTML.replace(/,/g, ''), 10) * intA; }); } } // 要素をリセット if (winW >= bkSp && this.$totalElm.find('.js-cart-tail')[0]){ this.$totalElm.find('.js-cart-tail').removeClass('on'); } // console.log(this.totalPrice); this.totalPrice = separate(this.totalPrice); this.setItem(bool); this.cartHeight(); this.view(); // implemented in side on the system $(document).trigger('custom.changeCartInfo', { itemArray: ItemArray, initDataArray: this.initDataArr }); }; // 「,」を付与 function separate(num){ num = String(num); var len = num.length; if (len > 3){ // 前半を引数に再帰呼び出し + 後半3桁 return separate(num.substring(0, len - 3)) + ',' + num.substring(len - 3); } else { return num; } } // カートに要素を追加 BoxOrder.prototype.setItem = function(){ // var $el = this.$totalElm.find('.total-item-list dl'); var _this = this; var cls = ''; var len = ItemArray.length; var totalHeight = 0; if(len > 0) { for (var i = 0; i < len; i++){ if (setVal === 1) { // $(this).closest('dl').find('.js-sub-total-price')[0].innerText = ItemArray[i].price; }else{ //cart pt1 var html = '

' + ItemArray[i].name + '×' + '' + ItemArray[i].intA + '

' + '
小計' + ItemArray[i].price + '(税込)
'; this.$totalElm.find('.total-item-list').append(html); var itemHeight = _this.$totalItemList.find('dl').eq(i).outerHeight() || 0; totalHeight += itemHeight; } } } checkOpenClose(); function checkOpenClose(){ if (_this.$allViewBtn === undefined) return; if (totalHeight >= maxCartHeight && flg){ _this.$totalItemList.addClass('hide'); } if (totalHeight <= maxCartHeight){ flg = false; _this.$totalItemList.removeClass('hide'); _this.allview(); } } this.translationCart(); }; // 合計金額をセット BoxOrder.prototype.view = function(){ var total; if (!this.$totalElm.hasClass('js-top-cart')) this.$totalElm.find('.js-total-price').text(this.totalPrice); if ($('.js-all-total-price')[0] !== undefined){ $('.js-total-price').each(function(){ total += $(this).html().replace(',', ''); }); $('.js-all-total-price').text(total); } // カートの合計金額が0の場合はテキストを表示 // if (parseInt(this.totalPrice, 10) !== 0){ if (this.$totalItemList.find('dl')[0] !== undefined ){ this.$totalElm.find('.js-empty-text').text('').css({'display':'none'}); } else { this.$totalElm.find('.js-empty-text').text('現在ご注文予定の商品はありません').css({'display': 'block'}); } }; // すべて見るボタンの挙動 BoxOrder.prototype.allview = function(){ if ($('#main')[0] === undefined) return; var headerH = $('.nav-anchor-02')[0] !== undefined ? $('.nav-anchor-02').outerHeight() : 0; var mainPos = $('#main').offset().top - headerH || 0; var outerHeight; if (flg){ this.$totalElm.find('.total-item-list').removeClass('hide'); this.$allViewBtn.removeClass('open').find('span').text('閉じる'); $('html,body').stop(true, true).animate({'scrollTop' : mainPos}, 800); flg = false; } else { outerHeight = this.$totalItemList.outerHeight() || 0; if (outerHeight >= maxCartHeight){ this.$totalItemList.addClass('hide'); } this.$allViewBtn.addClass('open').find('span').text('すべて見る'); flg = true; } this.translationCart(); this.cartHeight(); }; // 引数(要素名, 商品選択の最大値(デフォルトは30)) if ($('.js-form-item-list')[0] !== undefined) var boxorder = new BoxOrder($('.js-form-item-list')); if ($('.js-form-item-list-01')[0] !== undefined) var boxorder01 = new BoxOrder($('.js-form-item-list-01')); if ($('.js-form-item-list-02')[0] !== undefined) var boxorder02 = new BoxOrder($('.js-form-item-list-02'),10); if ($('.js-total-cart')[0] !== undefined) var boxorder03 = new BoxOrder(); }); ///////////////////////////////////////////// // //CheckBoxの挙動 // ///////////////////////////////////////////// $(function(){ $('.js-chk-box-01 input').attr('checked', false); var chkBox = function(el, n){ var $el = el; var $chk = $el.find('input[type="checkbox"]'); var max = n || 0; var len; function init(){ $chk.on('click', function(e){ if (len >= max && $(this).is(':checked')){ e.preventDefault(); } len = $el.find('input[type="checkbox"]:checked').length; }); } init(); }; chkBox($('.js-chk-box-01'),2); }); ///////////////////////////////////////////// // //全角→半角変換 // ///////////////////////////////////////////// $(function(){ var inputChange = function(el){ var $el = el; var keyFlg; $el.each(function(){ $(this).on('keyup focus', changeEvt(this)); }); $el.each(function(){ $(this).on('change', function(){ var data = $(this).val(); var hankaku = data.replace(/[0-9. ]/g,function(s){ return String.fromCharCode(s.charCodeAt(0)- 65248)} ); $(this).val(hankaku); }); }); function changeEvt(e){ var old = e.value; var v, str, othverVal, maxVal2; return function(){ v = e.value; str = $(this).val(); // console.log($(this).val()); // 全角数字は半角数字へ変換, 数字以外の文字列は削除 str = str // .replace(/[0-9.]/g, function (s) { // return String.fromCharCode(s.charCodeAt(0) - 65248); // }) .replace(/[^0-9 0-9]+/, ''); $(e).on('blur',function(){ var str = $(this).val(); str = str.replace(/[^0-9 0-9]+/, ''); $(this).val(str); // if ( e.value.match(/[0-9.]/g) ){ // str = e.value.replace(/[0-9.]/g, function (s) { // return String.fromCharCode(s.charCodeAt(0) - 65248); // }); // $(e).val(str); // } // if (e.value.match(/[^0-9]/g)){ // $(e).val($(t).attr('title')); // } // old = str; }); if (v !== str){ $(e).val(str); } if ( old != v){ old = v; } }; } }; if ($('.js-inputChange').length > 0) inputChange($('.js-inputChange')); }); /** *Select要素の変更 */ $(function(){ var FormSelect = function(el){ this.$el = el; this.$select = this.$el.find('select'); this.init(); }; FormSelect.prototype.init = function(){ var _this = this; this.$select.each(function(){ $(this).on('change', function(){ _this.setData($(this)); }); }); }; FormSelect.prototype.setData = function(t){ var text = t.find('option:selected').text() || ''; // var val = t.find('option:selected').val(); var index = t.prop('selectedIndex') || 0; this.view(t, text, index); }; FormSelect.prototype.view = function(t, val, index){ t.prev().text(val); if (index > 0){ t.prev().removeClass('default-label'); } else { if (parseInt(val, 10)) return; t.prev().addClass('default-label'); } }; // デフォルトのフォームセレクト if ($('.js-form-select')[0] !== undefined) var formSelect = new FormSelect($('.js-form-select')); }); // DOMの入れ替え $(function(){ var bkSp = 760; var spFlg = false; var cartListChange = function(el){ var $el = el; function init(){ $(window).on('load resize', function(){ var winW = Window.viewport().width; if (winW <= bkSp && !spFlg){ spFlg = true; view(); } else if (winW >= bkSp && spFlg){ spFlg = false; view(); } }); } function view(){ if (spFlg){ $el.each(function(){ var html = $(this).find('.title'); $(this).prepend(html); }); } else { $el.each(function(){ var html = $(this).find('.title'); $(this).find('.img').after(html); }); } } init(); }; if ($('.js-cart-list-change')[0] !== undefined) cartListChange($('.js-cart-list-change')); }); $(function(){ var InputHover = function(){ var $inputBox = $('.input-hover'); var width = 1064; $inputBox.on('focus', function(){ if( Window.viewport().width > width ){ $(this).css({ backgroundColor: '#f5f5fa', border:'1px solid #d0d2db' }); } }).on('blur', function(){ if( Window.viewport().width > width ){ $(this).css({ backgroundColor: '#ffffff', border:'1px solid #d0d2db' }); } }); $(window).on('resize', function(){ // ReferenceError 発生の為一時的にコメントアウト // windowResize(); }); }; InputHover(); }); // ---------------------------------------------------------------------------- // Form Validation // ---------------------------------------------------------------------------- $(function(){ $('.js-box-alert').hide(); $('.js-box-alert-address').hide(); if($('.disabled-input-01')[0] !== undefined) { $('.disabled-input-01')[0].addEventListener("selectstart", function(e){ console.log('selection started on #container element'); e.preventDefault(); }); } var checkBlur = function(){ $('.validate-required-01').find('input').on('blur', function(){ var $this = $(this); var $thisVal = $this.val(); var title = $this.attr('title'); valueCheck($this,$thisVal,title); }); $('.validate-required-02').find('input').on('click', function(){ var $this = $(this); var $thisVal = $this.val(); var title = $this.attr('title'); valueCheck($this,$thisVal,title); }); $('.validate-required-03').find('select').on('change', function(){ var $this = $(this).parent(); var $thisVal = $(this).find('option:selected').val(); var title = $(this).attr('title'); valueCheck($this,$thisVal,title,'select'); }); $('.validate-required-04.active').find('input').on('click', function(){ var $this = $(this).parent().parent(); var $thisVal = $(this).val(); var title = $(this).attr('title'); valueCheck($this,$thisVal,title); }); function valueCheck($this,$thisVal,title,el) { if ( $thisVal === title || $thisVal === '' ){ $this.parent().parent().find('.error-text').show(); $('.js-box-alert, .js-box-alert-02').show(); $this.addClass('error'); } else{ if( el === 'select'){ $this.parent().find('.error-text').hide(); $this.find('.error-text').hide(); }else{ $this.parent().parent().find('.error-text').hide(); } $('.js-box-alert, .js-box-alert-02').hide(); $this.removeClass('error'); } } }; $('.validate-required-02').find('label').on('click', function(){ var id = $(this).attr('for'); $('#'+id).prop('checked', true); $(this).parent().parent().removeClass('error'); $(this).parent().parent().parent().find('.error-text').not('.js-no-validate').remove(); $('.js-box-alert-02').hide(); }); $('.form-validate').each(function(){ $(this).submit(function(){ $('.js-box-alert, .js-box-alert-02').hide(); $(this).find('.validate-required-01').parent().find('.error-text').remove(); $(this).find('.validate-required-04').parent().find('.error-text').remove(); $(this).find('.validate-required-01 .error').removeClass('error'); $(this).find('.validate-required-01').each(function(){ var $input = $(this).find('input'); var $inputVal = $input.val(); if($inputVal === ""){ $input.addClass('error'); $(this).after('必須項目です。 '); } }); $(this).find('.validate-required-02').each(function(){ var errorText; $(this).removeClass('error'); var $checked_radio_count = $(this).find('input[type="radio"]:checked').size(); if( $checked_radio_count < 1 ){ if($('.form-validate').hasClass('js-validate-required-02-wrap')){ errorText = ''; } else if( $(this).hasClass('js-validate-type-01') ){ errorText = '送り状のご用意状況を選択してください。'; } else{ $(this).addClass('error'); errorText = '必須項目です。 '; } if( !$(this).next().hasClass('error-text') ){ $(this).after(errorText); } } }); //

特に取り扱いに注意が必要な場合(2つまで)

'); chkBox($('.js-chk-box-0' + i),2); } $('.placeholder').setPlaceholder('on'); }); var chkBox = function(el,n){ var $el = el, $chk = $el.find('input[type="checkbox"]'), max = n ? n : 0, len; function init(){ $chk.on('click', function(e) { if(len >= max && $(this).is(':checked') ) { e.preventDefault(); } len = $el.find('input[type="checkbox"]:checked').length; }); } init(); }; $.fn.setPlaceholder = function(options){ $(this).each(function() { var $this = $(this); var def = $this.attr('title'); if ($this.val() === '') { $this.val(def).addClass(options); } else if ($this.val() === def){ $this.addClass(options); } $this.bind('focus', function(){ if ($this.val() === def){ $this.val('').removeClass(options); } }).bind('blur', function(){ if ($this.val() === def){ $this.addClass(options); } else if ($this.val() === ''){ $this.val(def).addClass(options); } }); $this.attr('data-placeholder', 'true'); }); $('form:has([data-placeholder="true"])').bind('submit', function(){ $('[data-placeholder="true"]', this).each(function(){ if ($(this).val() === $(this).attr('title')){ $(this).val(''); } }); setTimeout(refill, 0); }); var refill = function(){ $('[data-placeholder="true"]').each(function(){ if($(this).val() === ''){ $(this).val($(this).attr('title')); } }); } }; } if( $('.js-box-item-property').length > 0 ){ boxItemProperty(); } var boxItemTextAlert = function(){ var $itemNumInput = $('.js-item-num-input'); var $jsAlertText = $('.js-alert-text'); $jsAlertText.hide(); $itemNumInput.on('blur', function(){ $jsAlertText.hide(); var inputVal = String( $(this).val() ); if( inputVal > 1 && inputVal < 10000 ){ $jsAlertText.show(); } else if( inputVal > 9999 ){ alert('9999個以内で入力してください'); } }); }; if( $('.js-alert-text').length > 0 ){ boxItemTextAlert(); } var clientCheck = function(){ var $checkClient = $('.js-check-client'); var $selectClient = $('.js-select-client'); var $selectClientSubmit = $('.js-check-client-submit'); var txtMarginSet = function(){ $('.v-center-03').each(function(){ var $this = $(this), $textInner = $(this).find('.text-inner'); $textInner.css({ 'margin-top' : - ( $($textInner).height() / 2 ) }).css("visibility","visible"); }); } $checkClient.on('click', function(){ CheckboxCheck(); setTimeout(function(){ txtMarginSet(); }, 100); }); var CheckboxCheck = function(){ if( $checkClient.find('.checkbox').prop('checked') ) { $selectClient.hide(); $('.form-input-01').hide(); $selectClientSubmit.show(); } else{ $selectClient.show(); $('.form-input-01').show(); $selectClientSubmit.hide(); } } CheckboxCheck(); }; if( $('.js-check-client').length > 0 ){ clientCheck(); } }); // ---------------------------------------------------------------------------- // More Button // ---------------------------------------------------------------------------- $(function(){ var sendDelete = function(){ if( $('.box-package') ){ var $boxPackage = $('.box-package'); var $delBtn = $boxPackage.find('.del-btn'); $delBtn.on('click', function() { $(this).closest('.box-package-item').remove(); // 要素が0になったら空の表示に切り替え if( $boxPackage.find('.box-package-item').length === 0 ){ $boxPackage.find('.box-content-01').css({'display':'block'}); } }); } }; sendDelete(); }); $(function(){ var radioShowHide = function(el) { var $el = el; var $chkbox = $el.find('input[type="checkbox"]'); var SPWidth = 760, TBWidth = 1064; init(); result(); function init(){ $chkbox.on('click', function() { result(); }); } function result(){ $el.each(function(i) { if($(this).find('input[type="checkbox"]').prop('checked')){ $(this).find('.js-radio_chk-box').show(); }else{ $(this).find('.js-radio_chk-box').hide(); } if(Window.viewport().width > SPWidth){ $('.box-send.js-set-height').matchHeight(); }else{ $('.box-send.js-set-height').css({'height': 'auto'}); } }); } }; if($('.js-radio_chk-01').length > 0) radioShowHide($('.js-radio_chk-01')); }); $(function(){ var ellipsis = function(container, el) { var $el = el; var $cloneElm = el.clone(true); var $clone = el.clone(true); var originalTxt = el.text(); var text = originalTxt; var w = Window.viewport().width; var breakSize = 760; load(); $(window).on('resize', function() { w = Window.viewport().width; load(); }); function load() { var timer = false; if (timer !== false) { clearTimeout(timer); } timer = setTimeout(function() { text = originalTxt; $clone = $cloneElm; run(); }, 500); } function run() { $clone.css({ display: 'none', position : 'absolute', overflow : 'visible' }) $clone.text(text); $el.after($clone); // while( (text.length > 1) && w <= 760 ) { if(w <= breakSize){ text = text.substr(0, 7); $clone.text(text + '...'); } // } // 文章を入れ替えて、複製した要素を削除する $el.text($clone.text()); $clone.remove(); } }; $(window).on('load',function() { if($('.js-ellipsis')[0] !== undefined) ellipsis( $('.js-ellipsis-container'), $('.js-ellipsis') ); }); });