Authored by 梁志锋

fastclick测试

1 -;(function () {  
2 - 'use strict';  
3 -  
4 - /**  
5 - * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.  
6 - *  
7 - * @codingstandard ftlabs-jsv2  
8 - * @copyright The Financial Times Limited [All Rights Reserved]  
9 - * @license MIT License (see LICENSE.txt)  
10 - */  
11 -  
12 - /*jslint browser:true, node:true*/  
13 - /*global define, Event, Node*/  
14 -  
15 -  
16 - /**  
17 - * Instantiate fast-clicking listeners on the specified layer.  
18 - *  
19 - * @constructor  
20 - * @param {Element} layer The layer to listen on  
21 - * @param {Object} [options={}] The options to override the defaults  
22 - */  
23 - function FastClick(layer, options) {  
24 - var oldOnClick;  
25 -  
26 - options = options || {};  
27 -  
28 - /**  
29 - * Whether a click is currently being tracked.  
30 - *  
31 - * @type boolean  
32 - */  
33 - this.trackingClick = false;  
34 -  
35 -  
36 - /**  
37 - * Timestamp for when click tracking started.  
38 - *  
39 - * @type number  
40 - */  
41 - this.trackingClickStart = 0;  
42 -  
43 -  
44 - /**  
45 - * The element being tracked for a click.  
46 - *  
47 - * @type EventTarget  
48 - */  
49 - this.targetElement = null;  
50 -  
51 -  
52 - /**  
53 - * X-coordinate of touch start event.  
54 - *  
55 - * @type number  
56 - */  
57 - this.touchStartX = 0;  
58 -  
59 -  
60 - /**  
61 - * Y-coordinate of touch start event.  
62 - *  
63 - * @type number  
64 - */  
65 - this.touchStartY = 0;  
66 -  
67 -  
68 - /**  
69 - * ID of the last touch, retrieved from Touch.identifier.  
70 - *  
71 - * @type number  
72 - */  
73 - this.lastTouchIdentifier = 0;  
74 -  
75 -  
76 - /**  
77 - * Touchmove boundary, beyond which a click will be cancelled.  
78 - *  
79 - * @type number  
80 - */  
81 - this.touchBoundary = options.touchBoundary || 10;  
82 -  
83 -  
84 - /**  
85 - * The FastClick layer.  
86 - *  
87 - * @type Element  
88 - */  
89 - this.layer = layer;  
90 -  
91 - /**  
92 - * The minimum time between tap(touchstart and touchend) events  
93 - *  
94 - * @type number  
95 - */  
96 - this.tapDelay = options.tapDelay || 200;  
97 -  
98 - /**  
99 - * The maximum time for a tap  
100 - *  
101 - * @type number  
102 - */  
103 - this.tapTimeout = options.tapTimeout || 700;  
104 -  
105 - if (FastClick.notNeeded(layer)) {  
106 - return;  
107 - }  
108 -  
109 - // Some old versions of Android don't have Function.prototype.bind  
110 - function bind(method, context) {  
111 - return function() { return method.apply(context, arguments); };  
112 - }  
113 -  
114 -  
115 - var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];  
116 - var context = this;  
117 - for (var i = 0, l = methods.length; i < l; i++) {  
118 - context[methods[i]] = bind(context[methods[i]], context);  
119 - }  
120 -  
121 - // Set up event handlers as required  
122 - if (deviceIsAndroid) {  
123 - layer.addEventListener('mouseover', this.onMouse, true);  
124 - layer.addEventListener('mousedown', this.onMouse, true);  
125 - layer.addEventListener('mouseup', this.onMouse, true);  
126 - }  
127 -  
128 - layer.addEventListener('click', this.onClick, true);  
129 - layer.addEventListener('touchstart', this.onTouchStart, false);  
130 - layer.addEventListener('touchmove', this.onTouchMove, false);  
131 - layer.addEventListener('touchend', this.onTouchEnd, false);  
132 - layer.addEventListener('touchcancel', this.onTouchCancel, false);  
133 -  
134 - // Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)  
135 - // which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick  
136 - // layer when they are cancelled.  
137 - if (!Event.prototype.stopImmediatePropagation) {  
138 - layer.removeEventListener = function(type, callback, capture) {  
139 - var rmv = Node.prototype.removeEventListener;  
140 - if (type === 'click') {  
141 - rmv.call(layer, type, callback.hijacked || callback, capture);  
142 - } else {  
143 - rmv.call(layer, type, callback, capture);  
144 - }  
145 - };  
146 -  
147 - layer.addEventListener = function(type, callback, capture) {  
148 - var adv = Node.prototype.addEventListener;  
149 - if (type === 'click') {  
150 - adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {  
151 - if (!event.propagationStopped) {  
152 - callback(event);  
153 - }  
154 - }), capture);  
155 - } else {  
156 - adv.call(layer, type, callback, capture);  
157 - }  
158 - };  
159 - }  
160 -  
161 - // If a handler is already declared in the element's onclick attribute, it will be fired before  
162 - // FastClick's onClick handler. Fix this by pulling out the user-defined handler function and  
163 - // adding it as listener.  
164 - if (typeof layer.onclick === 'function') {  
165 -  
166 - // Android browser on at least 3.2 requires a new reference to the function in layer.onclick  
167 - // - the old one won't work if passed to addEventListener directly.  
168 - oldOnClick = layer.onclick;  
169 - layer.addEventListener('click', function(event) {  
170 - oldOnClick(event);  
171 - }, false);  
172 - layer.onclick = null;  
173 - }  
174 - }  
175 -  
176 - /**  
177 - * Windows Phone 8.1 fakes user agent string to look like Android and iPhone.  
178 - *  
179 - * @type boolean  
180 - */  
181 - var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;  
182 -  
183 - /**  
184 - * Android requires exceptions.  
185 - *  
186 - * @type boolean  
187 - */  
188 - var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;  
189 -  
190 -  
191 - /**  
192 - * iOS requires exceptions.  
193 - *  
194 - * @type boolean  
195 - */  
196 - var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;  
197 -  
198 -  
199 - /**  
200 - * iOS 4 requires an exception for select elements.  
201 - *  
202 - * @type boolean  
203 - */  
204 - var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);  
205 -  
206 -  
207 - /**  
208 - * iOS 6.0-7.* requires the target element to be manually derived  
209 - *  
210 - * @type boolean  
211 - */  
212 - var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);  
213 -  
214 - /**  
215 - * BlackBerry requires exceptions.  
216 - *  
217 - * @type boolean  
218 - */  
219 - var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;  
220 -  
221 - /**  
222 - * Determine whether a given element requires a native click.  
223 - *  
224 - * @param {EventTarget|Element} target Target DOM element  
225 - * @returns {boolean} Returns true if the element needs a native click  
226 - */  
227 - FastClick.prototype.needsClick = function(target) {  
228 - switch (target.nodeName.toLowerCase()) {  
229 -  
230 - // Don't send a synthetic click to disabled inputs (issue #62)  
231 - case 'button':  
232 - case 'select':  
233 - case 'textarea':  
234 - if (target.disabled) {  
235 - return true;  
236 - }  
237 -  
238 - break;  
239 - case 'input':  
240 -  
241 - // File inputs need real clicks on iOS 6 due to a browser bug (issue #68)  
242 - if ((deviceIsIOS && target.type === 'file') || target.disabled) {  
243 - return true;  
244 - }  
245 -  
246 - break;  
247 - case 'label':  
248 - case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames  
249 - case 'video':  
250 - return true;  
251 - }  
252 -  
253 - return (/\bneedsclick\b/).test(target.className);  
254 - };  
255 -  
256 -  
257 - /**  
258 - * Determine whether a given element requires a call to focus to simulate click into element.  
259 - *  
260 - * @param {EventTarget|Element} target Target DOM element  
261 - * @returns {boolean} Returns true if the element requires a call to focus to simulate native click.  
262 - */  
263 - FastClick.prototype.needsFocus = function(target) {  
264 - switch (target.nodeName.toLowerCase()) {  
265 - case 'textarea':  
266 - return true;  
267 - case 'select':  
268 - return !deviceIsAndroid;  
269 - case 'input':  
270 - switch (target.type) {  
271 - case 'button':  
272 - case 'checkbox':  
273 - case 'file':  
274 - case 'image':  
275 - case 'radio':  
276 - case 'submit':  
277 - return false;  
278 - }  
279 -  
280 - // No point in attempting to focus disabled inputs  
281 - return !target.disabled && !target.readOnly;  
282 - default:  
283 - return (/\bneedsfocus\b/).test(target.className);  
284 - }  
285 - };  
286 -  
287 -  
288 - /**  
289 - * Send a click event to the specified element.  
290 - *  
291 - * @param {EventTarget|Element} targetElement  
292 - * @param {Event} event  
293 - */  
294 - FastClick.prototype.sendClick = function(targetElement, event) {  
295 - var clickEvent, touch;  
296 -  
297 - // On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)  
298 - if (document.activeElement && document.activeElement !== targetElement) {  
299 - document.activeElement.blur();  
300 - }  
301 -  
302 - touch = event.changedTouches[0];  
303 -  
304 - // Synthesise a click event, with an extra attribute so it can be tracked  
305 - clickEvent = document.createEvent('MouseEvents');  
306 - clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);  
307 - clickEvent.forwardedTouchEvent = true;  
308 - targetElement.dispatchEvent(clickEvent);  
309 - };  
310 -  
311 - FastClick.prototype.determineEventType = function(targetElement) {  
312 -  
313 - //Issue #159: Android Chrome Select Box does not open with a synthetic click event  
314 - if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {  
315 - return 'mousedown';  
316 - }  
317 -  
318 - return 'click';  
319 - };  
320 -  
321 -  
322 - /**  
323 - * @param {EventTarget|Element} targetElement  
324 - */  
325 - FastClick.prototype.focus = function(targetElement) {  
326 - var length;  
327 -  
328 - // Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.  
329 - if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {  
330 - length = targetElement.value.length;  
331 - targetElement.setSelectionRange(length, length);  
332 - } else {  
333 - targetElement.focus();  
334 - }  
335 - };  
336 -  
337 -  
338 - /**  
339 - * Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.  
340 - *  
341 - * @param {EventTarget|Element} targetElement  
342 - */  
343 - FastClick.prototype.updateScrollParent = function(targetElement) {  
344 - var scrollParent, parentElement;  
345 -  
346 - scrollParent = targetElement.fastClickScrollParent;  
347 -  
348 - // Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the  
349 - // target element was moved to another parent.  
350 - if (!scrollParent || !scrollParent.contains(targetElement)) {  
351 - parentElement = targetElement;  
352 - do {  
353 - if (parentElement.scrollHeight > parentElement.offsetHeight) {  
354 - scrollParent = parentElement;  
355 - targetElement.fastClickScrollParent = parentElement;  
356 - break;  
357 - }  
358 -  
359 - parentElement = parentElement.parentElement;  
360 - } while (parentElement);  
361 - }  
362 -  
363 - // Always update the scroll top tracker if possible.  
364 - if (scrollParent) {  
365 - scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;  
366 - }  
367 - };  
368 -  
369 -  
370 - /**  
371 - * @param {EventTarget} targetElement  
372 - * @returns {Element|EventTarget}  
373 - */  
374 - FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {  
375 -  
376 - // On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.  
377 - if (eventTarget.nodeType === Node.TEXT_NODE) {  
378 - return eventTarget.parentNode;  
379 - }  
380 -  
381 - return eventTarget;  
382 - };  
383 -  
384 -  
385 - /**  
386 - * On touch start, record the position and scroll offset.  
387 - *  
388 - * @param {Event} event  
389 - * @returns {boolean}  
390 - */  
391 - FastClick.prototype.onTouchStart = function(event) {  
392 - var targetElement, touch, selection;  
393 -  
394 - // Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).  
395 - if (event.targetTouches.length > 1) {  
396 - return true;  
397 - }  
398 -  
399 - targetElement = this.getTargetElementFromEventTarget(event.target);  
400 - touch = event.targetTouches[0];  
401 -  
402 - if (deviceIsIOS) {  
403 -  
404 - // Only trusted events will deselect text on iOS (issue #49)  
405 - selection = window.getSelection();  
406 - if (selection.rangeCount && !selection.isCollapsed) {  
407 - return true;  
408 - }  
409 -  
410 - if (!deviceIsIOS4) {  
411 -  
412 - // Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):  
413 - // when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched  
414 - // with the same identifier as the touch event that previously triggered the click that triggered the alert.  
415 - // Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an  
416 - // immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.  
417 - // Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,  
418 - // which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,  
419 - // random integers, it's safe to to continue if the identifier is 0 here.  
420 - if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {  
421 - event.preventDefault();  
422 - return false;  
423 - }  
424 -  
425 - this.lastTouchIdentifier = touch.identifier;  
426 -  
427 - // If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:  
428 - // 1) the user does a fling scroll on the scrollable layer  
429 - // 2) the user stops the fling scroll with another tap  
430 - // then the event.target of the last 'touchend' event will be the element that was under the user's finger  
431 - // when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check  
432 - // is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).  
433 - this.updateScrollParent(targetElement);  
434 - }  
435 - }  
436 -  
437 - this.trackingClick = true;  
438 - this.trackingClickStart = event.timeStamp;  
439 - this.targetElement = targetElement;  
440 -  
441 - this.touchStartX = touch.pageX;  
442 - this.touchStartY = touch.pageY;  
443 -  
444 - // Prevent phantom clicks on fast double-tap (issue #36)  
445 - if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {  
446 - event.preventDefault();  
447 - }  
448 -  
449 - return true;  
450 - };  
451 -  
452 -  
453 - /**  
454 - * Based on a touchmove event object, check whether the touch has moved past a boundary since it started.  
455 - *  
456 - * @param {Event} event  
457 - * @returns {boolean}  
458 - */  
459 - FastClick.prototype.touchHasMoved = function(event) {  
460 - var touch = event.changedTouches[0], boundary = this.touchBoundary;  
461 -  
462 - if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {  
463 - return true;  
464 - }  
465 -  
466 - return false;  
467 - };  
468 -  
469 -  
470 - /**  
471 - * Update the last position.  
472 - *  
473 - * @param {Event} event  
474 - * @returns {boolean}  
475 - */  
476 - FastClick.prototype.onTouchMove = function(event) {  
477 - if (!this.trackingClick) {  
478 - return true;  
479 - }  
480 -  
481 - // If the touch has moved, cancel the click tracking  
482 - if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {  
483 - this.trackingClick = false;  
484 - this.targetElement = null;  
485 - }  
486 -  
487 - return true;  
488 - };  
489 -  
490 -  
491 - /**  
492 - * Attempt to find the labelled control for the given label element.  
493 - *  
494 - * @param {EventTarget|HTMLLabelElement} labelElement  
495 - * @returns {Element|null}  
496 - */  
497 - FastClick.prototype.findControl = function(labelElement) {  
498 -  
499 - // Fast path for newer browsers supporting the HTML5 control attribute  
500 - if (labelElement.control !== undefined) {  
501 - return labelElement.control;  
502 - }  
503 -  
504 - // All browsers under test that support touch events also support the HTML5 htmlFor attribute  
505 - if (labelElement.htmlFor) {  
506 - return document.getElementById(labelElement.htmlFor);  
507 - }  
508 -  
509 - // If no for attribute exists, attempt to retrieve the first labellable descendant element  
510 - // the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label  
511 - return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');  
512 - };  
513 -  
514 -  
515 - /**  
516 - * On touch end, determine whether to send a click event at once.  
517 - *  
518 - * @param {Event} event  
519 - * @returns {boolean}  
520 - */  
521 - FastClick.prototype.onTouchEnd = function(event) {  
522 - var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;  
523 -  
524 - if (!this.trackingClick) {  
525 - return true;  
526 - }  
527 -  
528 - // Prevent phantom clicks on fast double-tap (issue #36)  
529 - if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {  
530 - this.cancelNextClick = true;  
531 - return true;  
532 - }  
533 -  
534 - if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {  
535 - return true;  
536 - }  
537 -  
538 - // Reset to prevent wrong click cancel on input (issue #156).  
539 - this.cancelNextClick = false;  
540 -  
541 - this.lastClickTime = event.timeStamp;  
542 -  
543 - trackingClickStart = this.trackingClickStart;  
544 - this.trackingClick = false;  
545 - this.trackingClickStart = 0;  
546 -  
547 - // On some iOS devices, the targetElement supplied with the event is invalid if the layer  
548 - // is performing a transition or scroll, and has to be re-detected manually. Note that  
549 - // for this to function correctly, it must be called *after* the event target is checked!  
550 - // See issue #57; also filed as rdar://13048589 .  
551 - if (deviceIsIOSWithBadTarget) {  
552 - touch = event.changedTouches[0];  
553 -  
554 - // In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null  
555 - targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;  
556 - targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;  
557 - }  
558 -  
559 - targetTagName = targetElement.tagName.toLowerCase();  
560 - if (targetTagName === 'label') {  
561 - forElement = this.findControl(targetElement);  
562 - if (forElement) {  
563 - this.focus(targetElement);  
564 - if (deviceIsAndroid) {  
565 - return false;  
566 - }  
567 -  
568 - targetElement = forElement;  
569 - }  
570 - } else if (this.needsFocus(targetElement)) {  
571 -  
572 - // Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.  
573 - // Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).  
574 - if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {  
575 - this.targetElement = null;  
576 - return false;  
577 - }  
578 -  
579 - this.focus(targetElement);  
580 - this.sendClick(targetElement, event);  
581 -  
582 - // Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.  
583 - // Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)  
584 - if (!deviceIsIOS || targetTagName !== 'select') {  
585 - this.targetElement = null;  
586 - event.preventDefault();  
587 - }  
588 -  
589 - return false;  
590 - }  
591 -  
592 - if (deviceIsIOS && !deviceIsIOS4) {  
593 -  
594 - // Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled  
595 - // and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).  
596 - scrollParent = targetElement.fastClickScrollParent;  
597 - if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {  
598 - return true;  
599 - }  
600 - }  
601 -  
602 - // Prevent the actual click from going though - unless the target node is marked as requiring  
603 - // real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.  
604 - if (!this.needsClick(targetElement)) {  
605 - event.preventDefault();  
606 - this.sendClick(targetElement, event);  
607 - }  
608 -  
609 - return false;  
610 - };  
611 -  
612 -  
613 - /**  
614 - * On touch cancel, stop tracking the click.  
615 - *  
616 - * @returns {void}  
617 - */  
618 - FastClick.prototype.onTouchCancel = function() {  
619 - this.trackingClick = false;  
620 - this.targetElement = null;  
621 - };  
622 -  
623 -  
624 - /**  
625 - * Determine mouse events which should be permitted.  
626 - *  
627 - * @param {Event} event  
628 - * @returns {boolean}  
629 - */  
630 - FastClick.prototype.onMouse = function(event) {  
631 -  
632 - // If a target element was never set (because a touch event was never fired) allow the event  
633 - if (!this.targetElement) {  
634 - return true;  
635 - }  
636 -  
637 - if (event.forwardedTouchEvent) {  
638 - return true;  
639 - }  
640 -  
641 - // Programmatically generated events targeting a specific element should be permitted  
642 - if (!event.cancelable) {  
643 - return true;  
644 - }  
645 -  
646 - // Derive and check the target element to see whether the mouse event needs to be permitted;  
647 - // unless explicitly enabled, prevent non-touch click events from triggering actions,  
648 - // to prevent ghost/doubleclicks.  
649 - if (!this.needsClick(this.targetElement) || this.cancelNextClick) {  
650 -  
651 - // Prevent any user-added listeners declared on FastClick element from being fired.  
652 - if (event.stopImmediatePropagation) {  
653 - event.stopImmediatePropagation();  
654 - } else {  
655 -  
656 - // Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)  
657 - event.propagationStopped = true;  
658 - }  
659 -  
660 - // Cancel the event  
661 - event.stopPropagation();  
662 - event.preventDefault();  
663 -  
664 - return false;  
665 - }  
666 -  
667 - // If the mouse event is permitted, return true for the action to go through.  
668 - return true;  
669 - };  
670 -  
671 -  
672 - /**  
673 - * On actual clicks, determine whether this is a touch-generated click, a click action occurring  
674 - * naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or  
675 - * an actual click which should be permitted.  
676 - *  
677 - * @param {Event} event  
678 - * @returns {boolean}  
679 - */  
680 - FastClick.prototype.onClick = function(event) {  
681 - var permitted;  
682 -  
683 - // It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.  
684 - if (this.trackingClick) {  
685 - this.targetElement = null;  
686 - this.trackingClick = false;  
687 - return true;  
688 - }  
689 -  
690 - // Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.  
691 - if (event.target.type === 'submit' && event.detail === 0) {  
692 - return true;  
693 - }  
694 -  
695 - permitted = this.onMouse(event);  
696 -  
697 - // Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.  
698 - if (!permitted) {  
699 - this.targetElement = null;  
700 - }  
701 -  
702 - // If clicks are permitted, return true for the action to go through.  
703 - return permitted;  
704 - };  
705 -  
706 -  
707 - /**  
708 - * Remove all FastClick's event listeners.  
709 - *  
710 - * @returns {void}  
711 - */  
712 - FastClick.prototype.destroy = function() {  
713 - var layer = this.layer;  
714 -  
715 - if (deviceIsAndroid) {  
716 - layer.removeEventListener('mouseover', this.onMouse, true);  
717 - layer.removeEventListener('mousedown', this.onMouse, true);  
718 - layer.removeEventListener('mouseup', this.onMouse, true);  
719 - }  
720 -  
721 - layer.removeEventListener('click', this.onClick, true);  
722 - layer.removeEventListener('touchstart', this.onTouchStart, false);  
723 - layer.removeEventListener('touchmove', this.onTouchMove, false);  
724 - layer.removeEventListener('touchend', this.onTouchEnd, false);  
725 - layer.removeEventListener('touchcancel', this.onTouchCancel, false);  
726 - };  
727 -  
728 -  
729 - /**  
730 - * Check whether FastClick is needed.  
731 - *  
732 - * @param {Element} layer The layer to listen on  
733 - */  
734 - FastClick.notNeeded = function(layer) {  
735 - var metaViewport;  
736 - var chromeVersion;  
737 - var blackberryVersion;  
738 - var firefoxVersion;  
739 -  
740 - // Devices that don't support touch don't need FastClick  
741 - if (typeof window.ontouchstart === 'undefined') {  
742 - return true;  
743 - }  
744 -  
745 - // Chrome version - zero for other browsers  
746 - chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];  
747 -  
748 - if (chromeVersion) {  
749 -  
750 - if (deviceIsAndroid) {  
751 - metaViewport = document.querySelector('meta[name=viewport]');  
752 -  
753 - if (metaViewport) {  
754 - // Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)  
755 - if (metaViewport.content.indexOf('user-scalable=no') !== -1) {  
756 - return true;  
757 - }  
758 - // Chrome 32 and above with width=device-width or less don't need FastClick  
759 - if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {  
760 - return true;  
761 - }  
762 - }  
763 -  
764 - // Chrome desktop doesn't need FastClick (issue #15)  
765 - } else {  
766 - return true;  
767 - }  
768 - }  
769 -  
770 - if (deviceIsBlackBerry10) {  
771 - blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);  
772 -  
773 - // BlackBerry 10.3+ does not require Fastclick library.  
774 - // https://github.com/ftlabs/fastclick/issues/251  
775 - if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {  
776 - metaViewport = document.querySelector('meta[name=viewport]');  
777 -  
778 - if (metaViewport) {  
779 - // user-scalable=no eliminates click delay.  
780 - if (metaViewport.content.indexOf('user-scalable=no') !== -1) {  
781 - return true;  
782 - }  
783 - // width=device-width (or less than device-width) eliminates click delay.  
784 - if (document.documentElement.scrollWidth <= window.outerWidth) {  
785 - return true;  
786 - }  
787 - }  
788 - }  
789 - }  
790 -  
791 - // IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)  
792 - if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {  
793 - return true;  
794 - }  
795 -  
796 - // Firefox version - zero for other browsers  
797 - firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];  
798 -  
799 - if (firefoxVersion >= 27) {  
800 - // Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896  
801 -  
802 - metaViewport = document.querySelector('meta[name=viewport]');  
803 - if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {  
804 - return true;  
805 - }  
806 - }  
807 -  
808 - // IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version  
809 - // http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx  
810 - if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {  
811 - return true;  
812 - }  
813 -  
814 - return false;  
815 - };  
816 -  
817 -  
818 - /**  
819 - * Factory method for creating a FastClick object  
820 - *  
821 - * @param {Element} layer The layer to listen on  
822 - * @param {Object} [options={}] The options to override the defaults  
823 - */  
824 - FastClick.attach = function(layer, options) {  
825 - return new FastClick(layer, options);  
826 - };  
827 -  
828 -  
829 - if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {  
830 -  
831 - // AMD. Register as an anonymous module.  
832 - define(function() {  
833 - return FastClick;  
834 - });  
835 - } else if (typeof module !== 'undefined' && module.exports) {  
836 - module.exports = FastClick.attach;  
837 - module.exports.FastClick = FastClick;  
838 - } else {  
839 - window.FastClick = FastClick;  
840 - }  
841 -}()); 1 +/** Shrinkwrap URL:
  2 + * /v2/bundles/js?modules=fastclick%401.0.6%2Co-autoinit%401.2.0&shrinkwrap=
  3 + */
  4 +!function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";n(1),window.Origami={fastclick:n(2),"o-autoinit":n(4)}},function(t,e){t.exports={name:"__MAIN__",dependencies:{fastclick:"fastclick#*","o-autoinit":"o-autoinit#^1.0.0"}}},function(t,e,n){t.exports=n(3)},function(t,e){"use strict";var n=!1;!function(){/**
  5 + * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
  6 + *
  7 + * @codingstandard ftlabs-jsv2
  8 + * @copyright The Financial Times Limited [All Rights Reserved]
  9 + * @license MIT License (see LICENSE.txt)
  10 + */
  11 +function e(t,n){function o(t,e){return function(){return t.apply(e,arguments)}}var r;if(n=n||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=n.touchBoundary||10,this.layer=t,this.tapDelay=n.tapDelay||200,this.tapTimeout=n.tapTimeout||700,!e.notNeeded(t)){for(var a=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],c=this,s=0,u=a.length;u>s;s++)c[a[s]]=o(c[a[s]],c);i&&(t.addEventListener("mouseover",this.onMouse,!0),t.addEventListener("mousedown",this.onMouse,!0),t.addEventListener("mouseup",this.onMouse,!0)),t.addEventListener("click",this.onClick,!0),t.addEventListener("touchstart",this.onTouchStart,!1),t.addEventListener("touchmove",this.onTouchMove,!1),t.addEventListener("touchend",this.onTouchEnd,!1),t.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(t.removeEventListener=function(e,n,o){var i=Node.prototype.removeEventListener;"click"===e?i.call(t,e,n.hijacked||n,o):i.call(t,e,n,o)},t.addEventListener=function(e,n,o){var i=Node.prototype.addEventListener;"click"===e?i.call(t,e,n.hijacked||(n.hijacked=function(t){t.propagationStopped||n(t)}),o):i.call(t,e,n,o)}),"function"==typeof t.onclick&&(r=t.onclick,t.addEventListener("click",function(t){r(t)},!1),t.onclick=null)}}var o=navigator.userAgent.indexOf("Windows Phone")>=0,i=navigator.userAgent.indexOf("Android")>0&&!o,r=/iP(ad|hone|od)/.test(navigator.userAgent)&&!o,a=r&&/OS 4_\d(_\d)?/.test(navigator.userAgent),c=r&&/OS [6-7]_\d/.test(navigator.userAgent),s=navigator.userAgent.indexOf("BB10")>0;e.prototype.needsClick=function(t){switch(t.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(t.disabled)return!0;break;case"input":if(r&&"file"===t.type||t.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(t.className)},e.prototype.needsFocus=function(t){switch(t.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!i;case"input":switch(t.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!t.disabled&&!t.readOnly;default:return/\bneedsfocus\b/.test(t.className)}},e.prototype.sendClick=function(t,e){var n,o;document.activeElement&&document.activeElement!==t&&document.activeElement.blur(),o=e.changedTouches[0],n=document.createEvent("MouseEvents"),n.initMouseEvent(this.determineEventType(t),!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,t.dispatchEvent(n)},e.prototype.determineEventType=function(t){return i&&"select"===t.tagName.toLowerCase()?"mousedown":"click"},e.prototype.focus=function(t){var e;r&&t.setSelectionRange&&0!==t.type.indexOf("date")&&"time"!==t.type&&"month"!==t.type?(e=t.value.length,t.setSelectionRange(e,e)):t.focus()},e.prototype.updateScrollParent=function(t){var e,n;if(e=t.fastClickScrollParent,!e||!e.contains(t)){n=t;do{if(n.scrollHeight>n.offsetHeight){e=n,t.fastClickScrollParent=n;break}n=n.parentElement}while(n)}e&&(e.fastClickLastScrollTop=e.scrollTop)},e.prototype.getTargetElementFromEventTarget=function(t){return t.nodeType===Node.TEXT_NODE?t.parentNode:t},e.prototype.onTouchStart=function(t){var e,n,o;if(t.targetTouches.length>1)return!0;if(e=this.getTargetElementFromEventTarget(t.target),n=t.targetTouches[0],r){if(o=window.getSelection(),o.rangeCount&&!o.isCollapsed)return!0;if(!a){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return t.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(e)}}return this.trackingClick=!0,this.trackingClickStart=t.timeStamp,this.targetElement=e,this.touchStartX=n.pageX,this.touchStartY=n.pageY,t.timeStamp-this.lastClickTime<this.tapDelay&&t.preventDefault(),!0},e.prototype.touchHasMoved=function(t){var e=t.changedTouches[0],n=this.touchBoundary;return Math.abs(e.pageX-this.touchStartX)>n||Math.abs(e.pageY-this.touchStartY)>n},e.prototype.onTouchMove=function(t){return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(t.target)||this.touchHasMoved(t))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},e.prototype.findControl=function(t){return void 0!==t.control?t.control:t.htmlFor?document.getElementById(t.htmlFor):t.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},e.prototype.onTouchEnd=function(t){var e,n,o,s,u,l=this.targetElement;if(!this.trackingClick)return!0;if(t.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(t.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=t.timeStamp,n=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,c&&(u=t.changedTouches[0],l=document.elementFromPoint(u.pageX-window.pageXOffset,u.pageY-window.pageYOffset)||l,l.fastClickScrollParent=this.targetElement.fastClickScrollParent),o=l.tagName.toLowerCase(),"label"===o){if(e=this.findControl(l)){if(this.focus(l),i)return!1;l=e}}else if(this.needsFocus(l))return t.timeStamp-n>100||r&&window.top!==window&&"input"===o?(this.targetElement=null,!1):(this.focus(l),this.sendClick(l,t),r&&"select"===o||(this.targetElement=null,t.preventDefault()),!1);return r&&!a&&(s=l.fastClickScrollParent,s&&s.fastClickLastScrollTop!==s.scrollTop)?!0:(this.needsClick(l)||(t.preventDefault(),this.sendClick(l,t)),!1)},e.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},e.prototype.onMouse=function(t){return this.targetElement?t.forwardedTouchEvent?!0:t.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)?(t.stopImmediatePropagation?t.stopImmediatePropagation():t.propagationStopped=!0,t.stopPropagation(),t.preventDefault(),!1):!0:!0},e.prototype.onClick=function(t){var e;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===t.target.type&&0===t.detail?!0:(e=this.onMouse(t),e||(this.targetElement=null),e)},e.prototype.destroy=function(){var t=this.layer;i&&(t.removeEventListener("mouseover",this.onMouse,!0),t.removeEventListener("mousedown",this.onMouse,!0),t.removeEventListener("mouseup",this.onMouse,!0)),t.removeEventListener("click",this.onClick,!0),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchcancel",this.onTouchCancel,!1)},e.notNeeded=function(t){var e,n,o,r;if("undefined"==typeof window.ontouchstart)return!0;if(n=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!i)return!0;if(e=document.querySelector("meta[name=viewport]")){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(n>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(s&&(o=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),o[1]>=10&&o[2]>=3&&(e=document.querySelector("meta[name=viewport]")))){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===t.style.msTouchAction||"manipulation"===t.style.touchAction?!0:(r=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1],r>=27&&(e=document.querySelector("meta[name=viewport]"),e&&(-1!==e.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))?!0:"none"===t.style.touchAction||"manipulation"===t.style.touchAction)},e.attach=function(t,n){return new e(t,n)},"function"==typeof n&&"object"==typeof n.amd&&n.amd?n(function(){return e}):"undefined"!=typeof t&&t.exports?(t.exports=e.attach,t.exports.FastClick=e):window.FastClick=e}()},function(t,e,n){t.exports=n(5)},function(t,e){"use strict";function n(t){t in o||(o[t]=!0,document.dispatchEvent(new CustomEvent("o."+t)))}var o={};if(window.addEventListener("load",n.bind(null,"load")),window.addEventListener("load",n.bind(null,"DOMContentLoaded")),document.addEventListener("DOMContentLoaded",n.bind(null,"DOMContentLoaded")),document.onreadystatechange=function(){"complete"===document.readyState?(n("DOMContentLoaded"),n("load")):"interactive"!==document.readyState||document.attachEvent||n("DOMContentLoaded")},"complete"===document.readyState?(n("DOMContentLoaded"),n("load")):"interactive"!==document.readyState||document.attachEvent||n("DOMContentLoaded"),document.attachEvent){var i=!1,r=50;try{i=null==window.frameElement&&document.documentElement}catch(a){}i&&i.doScroll&&!function c(){if(!("DOMContentLoaded"in o)){try{i.doScroll("left")}catch(t){return 5e3>r?setTimeout(c,r*=1.2):void 0}n("DOMContentLoaded")}}()}}]);
@@ -11,7 +11,7 @@ var $ = require('jquery'), @@ -11,7 +11,7 @@ var $ = require('jquery'),
11 11
12 var productId = $('#productId').val(); 12 var productId = $('#productId').val();
13 13
14 -var skn = $('#preferenceUrl').val().split('?')[1].split('&')[0].split('=')[1], 14 +var skn = $('#productSkn').val(),
15 productCode = $('#limitProductCode').val(); 15 productCode = $('#limitProductCode').val();
16 16
17 $('#likeBtn').on('touchstart', function() { 17 $('#likeBtn').on('touchstart', function() {
@@ -256,9 +256,11 @@ $basicBtnC:#eb0313; @@ -256,9 +256,11 @@ $basicBtnC:#eb0313;
256 } 256 }
257 257
258 .limit-sale { 258 .limit-sale {
  259 + height: 48px;
259 position: absolute; 260 position: absolute;
260 right: 84px; 261 right: 84px;
261 - top: 24px; 262 + top: 50%;
  263 + margin-top: -24px;
262 color: #d0021b; 264 color: #d0021b;
263 border: 2PX solid #d0021b; 265 border: 2PX solid #d0021b;
264 background-color: #fff; 266 background-color: #fff;
@@ -3,12 +3,12 @@ @@ -3,12 +3,12 @@
3 color: #444; 3 color: #444;
4 4
5 .top { 5 .top {
6 - font-size: 0.6rem;  
7 - height: 2rem;  
8 - line-height: 2.2rem;  
9 - margin-bottom: 0.1rem; 6 + font-size: 24px;
  7 + height: 80px;
  8 + line-height: 88px;
  9 + margin-bottom: 4px;
10 background-color: #fff; 10 background-color: #fff;
11 - padding: 0.2rem 0 0.2rem 0.5rem; 11 + padding: 8px 0 8px 20px;
12 12
13 13
14 div { 14 div {
@@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
16 display: inline-block; 16 display: inline-block;
17 float: left; 17 float: left;
18 img { 18 img {
19 - width: 1.5rem; 19 + width: 60px;
20 position: relative; 20 position: relative;
21 - top: 0.25rem; 21 + top: 10px;
22 } 22 }
23 } 23 }
24 24
@@ -31,60 +31,62 @@ @@ -31,60 +31,62 @@
31 31
32 .detail { 32 .detail {
33 background-color: #fff; 33 background-color: #fff;
34 - padding: 0.6rem 0.8rem;  
35 - border-bottom: 1px solid #e6e6e6; 34 + padding: 24px 32px;
  35 + border-bottom: 1PX solid #e6e6e6;
  36 + margin-bottom: 1rem;
36 37
37 .name { 38 .name {
38 - font-size: 0.9rem;  
39 - margin-bottom: 0.5rem; 39 + font-size: 36px;
  40 + margin-bottom: 20px;
40 } 41 }
41 .sale-info { 42 .sale-info {
42 - height: 1rem;  
43 - line-height: 1rem; 43 + height: 40px;
  44 + line-height: 40px;
44 } 45 }
45 .price { 46 .price {
46 - font-size: 0.8rem; 47 + font-size: 32px;
47 color: #d0021b; 48 color: #d0021b;
48 float: left; 49 float: left;
49 } 50 }
50 51
51 .date { 52 .date {
52 - font-size: 0.6rem; 53 + font-size: 24px;
53 float: right; 54 float: right;
54 55
55 .text { 56 .text {
56 position: relative; 57 position: relative;
57 - top: 0.08rem; 58 + top: 3.2px;
58 } 59 }
59 } 60 }
60 } 61 }
61 62
62 .goodDesc { 63 .goodDesc {
63 - margin-top: 1rem;  
64 - padding: 0.5rem;  
65 - border-top: 1px solid #e6e6e6; 64 + padding: 20px;
  65 + border-top: 1PX solid #e6e6e6;
66 background-color: #fff; 66 background-color: #fff;
67 67
68 p { 68 p {
69 - font-size: 0.6rem;  
70 - line-height: 1rem; 69 + font-size: 24px;
  70 + line-height: 40px;
  71 + text-indent: 2em;
71 } 72 }
72 73
73 img { 74 img {
74 - margin: 0.3rem 0; 75 + margin: 12px 0;
  76 + max-width: 100%;
75 } 77 }
76 } 78 }
77 79
78 .bottom { 80 .bottom {
79 background-color: #fff; 81 background-color: #fff;
80 - padding: 0.5rem 2rem 2rem 2rem;  
81 - height: 3rem;  
82 - width: 12rem; 82 + padding: 20px 80px 80px 80px;
  83 + height: 120px;
  84 + width: 480px;
83 margin: 0 auto; 85 margin: 0 auto;
84 86
85 .logo { 87 .logo {
86 width: 100; 88 width: 100;
87 - height: 2.5rem; 89 + height: 100px;
88 90
89 background-image: resolve('logo-bottom.png'); 91 background-image: resolve('logo-bottom.png');
90 background-size: 100%; 92 background-size: 100%;
@@ -93,11 +95,11 @@ @@ -93,11 +95,11 @@
93 } 95 }
94 96
95 .btn { 97 .btn {
96 - font-size: 0.8rem; 98 + font-size: 32px;
97 background-color: #fff; 99 background-color: #fff;
98 - border: 1px solid #444;  
99 - border-radius: 0.2rem;  
100 - padding: 0.3rem 0.6rem; 100 + border: 1PX solid #444;
  101 + border-radius: 8px;
  102 + padding: 12px 24px;
101 } 103 }
102 104
103 .btn:active { 105 .btn:active {
@@ -115,7 +117,7 @@ @@ -115,7 +117,7 @@
115 117
116 .right { 118 .right {
117 width: 60%; 119 width: 60%;
118 - font-size: 0.65rem; 120 + font-size: 26px;
119 121
120 span { 122 span {
121 display: block; 123 display: block;
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 background-color: #fff; 35 background-color: #fff;
36 padding: 0.6rem 0.8rem; 36 padding: 0.6rem 0.8rem;
37 border-bottom: 1px solid #e6e6e6; 37 border-bottom: 1px solid #e6e6e6;
  38 + margin-bottom: 1rem;
38 39
39 .name { 40 .name {
40 font-size: 0.9rem; 41 font-size: 0.9rem;
@@ -62,15 +63,19 @@ @@ -62,15 +63,19 @@
62 } 63 }
63 64
64 .goodDesc { 65 .goodDesc {
65 - margin-top: 1rem; 66 + padding: 0.5rem;
  67 + border-top: 1px solid #e6e6e6;
  68 + background-color: #fff;
66 69
67 p { 70 p {
68 font-size: 0.6rem; 71 font-size: 0.6rem;
69 line-height: 1rem; 72 line-height: 1rem;
  73 + text-indent: 2em;
70 } 74 }
71 75
72 img { 76 img {
73 margin: 0.3rem 0; 77 margin: 0.3rem 0;
  78 + max-width: 100%;
74 } 79 }
75 } 80 }
76 81
@@ -287,9 +287,11 @@ $basicBtnC:#eb0313; @@ -287,9 +287,11 @@ $basicBtnC:#eb0313;
287 } 287 }
288 288
289 .limit-sale { 289 .limit-sale {
  290 + height: pxToRem(48px);
290 position: absolute; 291 position: absolute;
291 right: pxToRem(84px); 292 right: pxToRem(84px);
292 - top: pxToRem(24px); 293 + top: 50%;
  294 + margin-top: pxToRem(-24px);
293 color: #d0021b; 295 color: #d0021b;
294 border: 2px solid #d0021b; 296 border: 2px solid #d0021b;
295 background-color: #fff; 297 background-color: #fff;
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 background-color: #fff; 35 background-color: #fff;
36 padding: 0.6rem 0.8rem; 36 padding: 0.6rem 0.8rem;
37 border-bottom: 1px solid #e6e6e6; 37 border-bottom: 1px solid #e6e6e6;
  38 + margin-bottom: 1rem;
38 39
39 .name { 40 .name {
40 font-size: 0.9rem; 41 font-size: 0.9rem;
@@ -62,7 +63,6 @@ @@ -62,7 +63,6 @@
62 } 63 }
63 64
64 .goodDesc { 65 .goodDesc {
65 - margin-top: 1rem;  
66 padding: 0.5rem; 66 padding: 0.5rem;
67 border-top: 1px solid #e6e6e6; 67 border-top: 1px solid #e6e6e6;
68 background-color: #fff; 68 background-color: #fff;
@@ -70,10 +70,12 @@ @@ -70,10 +70,12 @@
70 p { 70 p {
71 font-size: 0.6rem; 71 font-size: 0.6rem;
72 line-height: 1rem; 72 line-height: 1rem;
  73 + text-indent: 2em;
73 } 74 }
74 75
75 img { 76 img {
76 margin: 0.3rem 0; 77 margin: 0.3rem 0;
  78 + max-width: 100%;
77 } 79 }
78 } 80 }
79 81
  1 +{{!-- APP 如何获得限购码 --}}
  2 +<!DOCTYPE html>
  3 +<html lang="en">
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <title>如何获得限购码</title>
  7 + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  8 + <meta http-equiv="cleartype" content="on">
  9 + <meta content="telephone=no" name="format-detection" />
  10 + <script type="text/javascript">
  11 + (function(doc, win) {
  12 + var docEl = doc.documentElement;
  13 + (function() {
  14 + var clientWidth = docEl.clientWidth;
  15 + if (!clientWidth) {
  16 + return;
  17 + }
  18 + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  19 + }());
  20 + })(document, window);
  21 + </script>
  22 + <style>
  23 + html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video, .yoho-header .nav-back, .yoho-header .nav-home, .yoho-header .nav-btn {
  24 + margin: 0;
  25 + padding: 0;
  26 + border: 0;
  27 + font: inherit;
  28 + font-size: 100%;
  29 + vertical-align: baseline;
  30 + }
  31 +
  32 + html {
  33 + line-height: 1;
  34 + }
  35 +
  36 + ol, ul {
  37 + list-style: none;
  38 + }
  39 +
  40 + table {
  41 + border-collapse: collapse;
  42 + border-spacing: 0;
  43 + }
  44 +
  45 + caption, th, td {
  46 + text-align: left;
  47 + font-weight: normal;
  48 + vertical-align: middle;
  49 + }
  50 +
  51 + q, blockquote {
  52 + quotes: none;
  53 + }
  54 +
  55 + q:before, q:after, blockquote:before, blockquote:after {
  56 + content: "";
  57 + content: none;
  58 + }
  59 +
  60 + a img {
  61 + border: none;
  62 + }
  63 +
  64 + article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary, .yoho-header .nav-back, .yoho-header .nav-home, .yoho-header .nav-btn {
  65 + display: block;
  66 + }
  67 + /*Reset End*/
  68 +
  69 + .clearfix:after{
  70 + content: '';
  71 + display: table;
  72 + clear: both;
  73 + }
  74 +
  75 + * {
  76 + -webkit-tap-highlight-color: rgba(0,0,0,0);
  77 + -moz-tap-highlight-color: rgba(0,0,0,0);
  78 + tap-highlight-color: rgba(0,0,0,0);
  79 + }
  80 +
  81 + html, body {
  82 + font-family: helvetica,Arial,"黑体";
  83 + width: 100%;
  84 + font-size: 12PX;
  85 + line-height: 1.4;
  86 + }
  87 +
  88 + button, input, select, textarea {
  89 + font-size: 100%;
  90 + margin: 0;
  91 + }
  92 +
  93 + img {
  94 + max-width: 100%;
  95 + display: block;
  96 + border: 0;
  97 + margin: 0 auto;
  98 + }
  99 +
  100 + a {
  101 + text-decoration: none;
  102 + outline: none;
  103 + color: #000
  104 + }
  105 +
  106 + a:link, a:visited, a:hover, a:actived{
  107 + color: #000;
  108 + }
  109 +
  110 + *:focus {
  111 + outline: none;
  112 + }
  113 +
  114 + .hide {
  115 + display: none;
  116 + }
  117 +
  118 + .overflow-hidden {
  119 + overflow: hidden;
  120 + }
  121 +
  122 + @font-face {
  123 + font-family: "iconfont";
  124 + src: url('../font/iconfont.eot'); /* IE9*/
  125 + src: url('../font/iconfont.eot?#iefix') format('embedded-opentype'),
  126 + url('../font/iconfont.woff') format('woff'),
  127 + url('../font/iconfont.ttf') format('truetype'),
  128 + url('../font/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
  129 + }
  130 +
  131 + .iconfont {
  132 + font-family: "iconfont" !important;
  133 + font-size: 16PX;
  134 + font-style: normal;
  135 + text-decoration: none;
  136 + -webkit-font-smoothing: antialiased;
  137 + -webkit-text-stroke-width: 0.2PX;
  138 + -moz-osx-font-smoothing: grayscale;
  139 + }
  140 + .limit-help-page{
  141 + padding: 0.7rem;
  142 + color: #444;
  143 + }
  144 + .limit-help-page h2{
  145 + font-size: 0.75rem;
  146 + font-weight: bold;
  147 + }
  148 + .limit-help-page .method{
  149 + display: block;
  150 + width: 2.3rem;
  151 + height: 0.875rem;
  152 + line-height: 0.9rem;
  153 + background-color: #444;
  154 + color: #fff;
  155 + border-radius: 0.5rem;
  156 + text-align: center;
  157 + margin: 0.5rem 0;
  158 + }
  159 + .limit-help-page li{
  160 + font-size: 0.6rem;
  161 + }
  162 + .limit-help-page .intro-img{
  163 + width: 100%;
  164 + height: 5.5rem;
  165 + background-size: 100%;
  166 + background-repeat: no-repeat;
  167 + margin: 0.5rem 0;
  168 + }
  169 + .limit-help-page .method-1 li:nth-child(1) .intro-img{
  170 + background-image: url('../assets/img/product/help/1.png');
  171 + }
  172 + .limit-help-page .method-1 li:nth-child(2) .intro-img{
  173 + background-image: url('../assets/img/product/help/2.png');
  174 + }
  175 + .limit-help-page .method-1 li:nth-child(3) .intro-img{
  176 + background-image: url('../assets/img/product/help/3.png');
  177 + }
  178 + .limit-help-page .method-2 li:nth-child(1) .intro-img{
  179 + background-image: url('../assets/img/product/help/4.png');
  180 + }
  181 + .limit-help-page .method-2 li:nth-child(2) .intro-img{
  182 + background-image: url('../assets/img/product/help/5.png');
  183 + }
  184 + .limit-help-page .method-2 li:nth-child(3) .intro-img{
  185 + background-image: url('../assets/img/product/help/6.png');
  186 + }
  187 + .limit-help-page .method-2 li:nth-child(4) .intro-img{
  188 + background-image: url('../assets/img/product/help/7.png');
  189 + }
  190 + .limit-help-page .how li:nth-child(1) .intro-img{
  191 + background-image: url('../assets/img/product/help/8.png');
  192 + }
  193 + .limit-help-page .how li:nth-child(2) .intro-img{
  194 + background-image: url('../assets/img/product/help/9.png');
  195 + margin-bottom: 0;
  196 + }
  197 + </style>
  198 +
  199 +</head>
  200 +<body>
  201 + <div class="limit-help-page yoho-page">
  202 + <ul class="method-2">
  203 + <li>1.在限定发售详情页点击参加排队赢取限购码图标。
  204 + <div class="intro-img"></div>
  205 + </li>
  206 + <li>2.进入限定发售排队页面,点击参加排队。
  207 + <div class="intro-img"></div>
  208 + </li>
  209 + <li>3.排队成功后凭排队序列号作为抽奖凭证,等待开奖时间。
  210 + <div class="intro-img"></div>
  211 + </li>
  212 + <li>4.开奖后,排队页面会公布中奖名单,限购码会直接发送至账户。
  213 + <div class="intro-img"></div>
  214 + </li>
  215 + </ul>
  216 + <h2>查看和使用限购码</h2>
  217 + <ul class="how">
  218 + <li>1.从个人中心进入我的限购码页面,可查看所获取的限购码。
  219 + <div class="intro-img"></div>
  220 + </li>
  221 + <li>2.商品开售后,可凭此限购码购买对应商品。
  222 + <div class="intro-img"></div>
  223 + </li>
  224 + </ul>
  225 + </div>
  226 +</body>
  227 +</html>
@@ -24,8 +24,19 @@ @@ -24,8 +24,19 @@
24 padding: 0; 24 padding: 0;
25 font-family: helvetica,Arial,"黑体"; 25 font-family: helvetica,Arial,"黑体";
26 } 26 }
27 - div {  
28 - padding: 0.7rem 27 + body {
  28 + background-color: #ccc;
  29 + }
  30 + .container {
  31 + padding: 0.7rem;
  32 + background-color: #fff;
  33 + }
  34 + .row {
  35 + border-bottom: 1px solid #b4b4b4;
  36 + padding-bottom: 0.2rem;
  37 + }
  38 + .block {
  39 + margin-bottom: 0.5rem
29 } 40 }
30 p { 41 p {
31 font-size: 0.7rem; 42 font-size: 0.7rem;
@@ -33,32 +44,32 @@ @@ -33,32 +44,32 @@
33 margin: 0.3rem 0; 44 margin: 0.3rem 0;
34 line-height: 1rem; 45 line-height: 1rem;
35 } 46 }
36 -  
37 - span {  
38 - font-weight: bold;  
39 - }  
40 </style> 47 </style>
41 </head> 48 </head>
42 <body> 49 <body>
43 - <div>  
44 - <p>  
45 - <span>介绍:</span>  
46 - 限购码是指用于删除商品的一种权利,达到一定条件即可获得。  
47 - </p>  
48 - <p>  
49 - <span>优势:</span>  
50 - 限定商品购买权  
51 - </p>  
52 - <p>  
53 - <span>用户:</span>  
54 - Yoho!Buy有货忠实用户  
55 - </p>  
56 - <p>  
57 - <span>如何使用:</span>  
58 - 相关商品开放购买的时候,页面会出现使用限购码的按钮,点击购买即可。  
59 - <br>  
60 - 限购码对应的商品是唯一的,一个码只可买一个商品。  
61 - </p> 50 + <div class="container">
  51 + <p> 1.当稀缺商品上架,同一用户账号在一定时间段内,仅支持购买1件该商品。 </p>
  52 + <p> 2.可通过分享或其他活动获得该商品的限购码,每个商品仅可获得1次限购码。 </p>
  53 + <p> 3.若下单未付款导致交易取消,不会扣限购额度。已付款状态下,无论是否退款则扣除限购额度。 </p>
  54 + <br>
  55 + <div class="block">
  56 + <p class="row">
  57 + Q:限购码可以送给我的朋友吗?
  58 + </p>
  59 + <p>
  60 + A:限购码不可赠送,只能自己账号使用。可以把活动告诉朋友,参与即可获得限购码。
  61 + </p>
  62 + </div>
  63 +
  64 + <div>
  65 + <p class="row">
  66 + Q:下单发现买错码数了,取消订单后我还能再买吗?
  67 + </p>
  68 + <p>
  69 + A:尚未付款的订单取消后,可以再次购买。
  70 + </p>
  71 + </div>
  72 +
62 </div> 73 </div>
63 </body> 74 </body>
64 </html> 75 </html>
@@ -177,6 +177,8 @@ @@ -177,6 +177,8 @@
177 <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}"> 177 <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}">
178 {{/if}} 178 {{/if}}
179 179
  180 + <input id="productSkn" type="hidden" value="{{productSkn}}">
  181 +
180 {{#loginUrl}} 182 {{#loginUrl}}
181 <input type="hidden" name="loginUrl" id="loginUrl" value="{{.}}"> 183 <input type="hidden" name="loginUrl" id="loginUrl" value="{{.}}">
182 {{/loginUrl}} 184 {{/loginUrl}}
@@ -59,6 +59,8 @@ class SideModel @@ -59,6 +59,8 @@ class SideModel
59 59
60 // 如果存在子菜单,就输出子菜单 60 // 如果存在子菜单,就输出子菜单
61 if (isset($value['sub']) && !empty($value['sub'])) { 61 if (isset($value['sub']) && !empty($value['sub'])) {
  62 + unset($group[$groupKey]['url']);
  63 +
62 $subs = array( 64 $subs = array(
63 array( 65 array(
64 'textCn' => $group[$groupKey]['textCn'], 66 'textCn' => $group[$groupKey]['textCn'],
@@ -169,6 +169,8 @@ class DetailModel @@ -169,6 +169,8 @@ class DetailModel
169 $result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']), ''); 169 $result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']), '');
170 } 170 }
171 171
  172 + $result['productSkn'] = $baseInfo['erpProductId'];
  173 +
172 // 商品信息 174 // 商品信息
173 if (!empty($baseInfo['goodsList'])) { 175 if (!empty($baseInfo['goodsList'])) {
174 $colorGroup = array(); 176 $colorGroup = array();
@@ -214,10 +216,10 @@ class DetailModel @@ -214,10 +216,10 @@ class DetailModel
214 'sizeNum' => $size['goodsSizeStorageNum'], 216 'sizeNum' => $size['goodsSizeStorageNum'],
215 ); 217 );
216 $sizeName = $size['sizeName']; 218 $sizeName = $size['sizeName'];
217 - 219 +
218 // 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色 220 // 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
219 - $allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])  
220 - ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id']) 221 + $allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
  222 + ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
221 : $allSizeList[$sizeName]; 223 : $allSizeList[$sizeName];
222 $colorStorageNum += intval($size['goodsSizeStorageNum']); 224 $colorStorageNum += intval($size['goodsSizeStorageNum']);
223 $colorStorageGroup[ $value['productSkc'] ][$sizeName] = intval($size['goodsSizeStorageNum']); 225 $colorStorageGroup[ $value['productSkc'] ][$sizeName] = intval($size['goodsSizeStorageNum']);
@@ -239,7 +241,7 @@ class DetailModel @@ -239,7 +241,7 @@ class DetailModel
239 // 商品库存总数 241 // 商品库存总数
240 $totalStorageNum += $colorStorageNum; 242 $totalStorageNum += $colorStorageNum;
241 } 243 }
242 - 244 +
243 // 遍历所有尺码,构建颜色显示数据 245 // 遍历所有尺码,构建颜色显示数据
244 $i = 1; 246 $i = 1;
245 foreach ($allSizeList as $sizeName => $value) { 247 foreach ($allSizeList as $sizeName => $value) {
@@ -256,7 +258,7 @@ class DetailModel @@ -256,7 +258,7 @@ class DetailModel
256 $colorGroup[$i]['color'][] = $colorArr; 258 $colorGroup[$i]['color'][] = $colorArr;
257 } 259 }
258 $colorGroup[$i]['id'] = $value['id']; 260 $colorGroup[$i]['id'] = $value['id'];
259 - 261 +
260 ++ $i; 262 ++ $i;
261 } 263 }
262 // 遍历所有颜色, 构建尺码显示数据 264 // 遍历所有颜色, 构建尺码显示数据
@@ -267,7 +269,7 @@ class DetailModel @@ -267,7 +269,7 @@ class DetailModel
267 $sizeGroup[$i]['colorId'] = $value['skcId']; 269 $sizeGroup[$i]['colorId'] = $value['skcId'];
268 // 默认颜色 270 // 默认颜色
269 $colorGroup[0]['color'][] = $value; 271 $colorGroup[0]['color'][] = $value;
270 - 272 +
271 ++ $i; 273 ++ $i;
272 } 274 }
273 275
@@ -673,7 +675,7 @@ class DetailModel @@ -673,7 +675,7 @@ class DetailModel
673 $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total)))); 675 $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
674 break; 676 break;
675 } 677 }
676 - 678 +
677 // 处理数据 679 // 处理数据
678 $record = DetailData::upvoteConsult($uid, $id); 680 $record = DetailData::upvoteConsult($uid, $id);
679 if (!empty($record['code'])) { 681 if (!empty($record['code'])) {
@@ -705,7 +707,7 @@ class DetailModel @@ -705,7 +707,7 @@ class DetailModel
705 $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total)))); 707 $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
706 break; 708 break;
707 } 709 }
708 - 710 +
709 // 处理数据 711 // 处理数据
710 $record = DetailData::usefulConsult($uid, $id); 712 $record = DetailData::usefulConsult($uid, $id);
711 if (!empty($record['code'])) { 713 if (!empty($record['code'])) {