恢复分享界面的移动端

This commit is contained in:
小胡
2024-07-30 17:09:08 +08:00
Unverified
parent 8ad1182298
commit 74c58bd5c0
58 changed files with 12719 additions and 56 deletions

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jquery-weui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.aptana.projects.webnature</nature>
</natures>
</projectDescription>

File diff suppressed because one or more lines are too long

5
static/jquery_weui/css/weui.min.css vendored Normal file

File diff suppressed because one or more lines are too long

214
static/jquery_weui/js/appevent.js vendored Normal file
View File

@@ -0,0 +1,214 @@
/**
* Created by a on 2018/5/3.
*/
(function($){
var touch = {},
touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,
longTapDelay = 300,
gesture,
down, up, move,
eventMap,
initialized = false
function swipeDirection(x1, x2, y1, y2) {
return Math.abs(x1 - x2) >=
Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down')
}
function longTap() {
longTapTimeout = null
if (touch.last) {
touch.el.trigger('longTap')
touch = {}
}
}
function cancelLongTap() {
if (longTapTimeout) clearTimeout(longTapTimeout)
longTapTimeout = null
}
function cancelAll() {
if (touchTimeout) clearTimeout(touchTimeout)
if (tapTimeout) clearTimeout(tapTimeout)
if (swipeTimeout) clearTimeout(swipeTimeout)
if (longTapTimeout) clearTimeout(longTapTimeout)
touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null
touch = {}
}
function isPrimaryTouch(event){
return (event.pointerType == 'touch' ||
event.pointerType == event.MSPOINTER_TYPE_TOUCH)
&& event.isPrimary
}
function isPointerEventType(e, type){
return (e.type == 'pointer'+type ||
e.type.toLowerCase() == 'mspointer'+type)
}
// helper function for tests, so they check for different APIs
function unregisterTouchEvents(){
if (!initialized) return
$(document).off(eventMap.down, down)
.off(eventMap.up, up)
.off(eventMap.move, move)
.off(eventMap.cancel, cancelAll)
$(window).off('scroll', cancelAll)
cancelAll()
initialized = false
}
function setup(__eventMap){
var now, delta, deltaX = 0, deltaY = 0, firstTouch, _isPointerType
unregisterTouchEvents()
eventMap = (__eventMap && ('down' in __eventMap)) ? __eventMap :
('ontouchstart' in document ?
{ 'down': 'touchstart', 'up': 'touchend',
'move': 'touchmove', 'cancel': 'touchcancel' } :
'onpointerdown' in document ?
{ 'down': 'pointerdown', 'up': 'pointerup',
'move': 'pointermove', 'cancel': 'pointercancel' } :
'onmspointerdown' in document ?
{ 'down': 'MSPointerDown', 'up': 'MSPointerUp',
'move': 'MSPointerMove', 'cancel': 'MSPointerCancel' } : false)
// No API availables for touch events
if (!eventMap) return
if ('MSGesture' in window) {
gesture = new MSGesture()
gesture.target = document.body
$(document)
.bind('MSGestureEnd', function(e){
var swipeDirectionFromVelocity =
e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null
if (swipeDirectionFromVelocity) {
touch.el.trigger('swipe')
touch.el.trigger('swipe'+ swipeDirectionFromVelocity)
}
})
}
down = function(e){
if((_isPointerType = isPointerEventType(e, 'down')) &&
!isPrimaryTouch(e)) return
firstTouch = _isPointerType ? e :((e.touches) ? e.touches[0]:e.originalEvent.changedTouches[0])
if (e.touches && e.touches.length === 1 && touch.x2) {
// Clear out touch movement data if we have it sticking around
// This can occur if touchcancel doesn't fire due to preventDefault, etc.
touch.x2 = undefined
touch.y2 = undefined
}
now = Date.now()
delta = now - (touch.last || now)
touch.el = jQuery('tagName' in firstTouch.target ?
firstTouch.target : firstTouch.target.parentNode)
touchTimeout && clearTimeout(touchTimeout)
touch.x1 = firstTouch.pageX
touch.y1 = firstTouch.pageY
if (delta > 0 && delta <= 250) touch.isDoubleTap = true
touch.last = now
longTapTimeout = setTimeout(longTap, longTapDelay)
// adds the current touch contact for IE gesture recognition
if (gesture && _isPointerType) gesture.addPointer(e.pointerId)
}
move = function(e){
if((_isPointerType = isPointerEventType(e, 'move')) &&
!isPrimaryTouch(e)) return
firstTouch = _isPointerType ? e :((e.touches) ? e.touches[0]:e.originalEvent.changedTouches[0])
cancelLongTap()
touch.x2 = firstTouch.pageX
touch.y2 = firstTouch.pageY
deltaX += Math.abs(touch.x1 - touch.x2)
deltaY += Math.abs(touch.y1 - touch.y2)
}
up = function(e){
if((_isPointerType = isPointerEventType(e, 'up')) &&
!isPrimaryTouch(e)) return
cancelLongTap()
// swipe
if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) ||
(touch.y2 && Math.abs(touch.y1 - touch.y2) > 30))
swipeTimeout = setTimeout(function() {
if (touch.el){
touch.el.trigger('swipe')
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)))
}
touch = {}
}, 0)
// normal tap
else if ('last' in touch)
// don't fire tap when delta position changed by more than 30 pixels,
// for instance when moving to a point and back to origin
if (deltaX < 30 && deltaY < 30) {
// delay by one tick so we can cancel the 'tap' event if 'scroll' fires
// ('tap' fires before 'scroll')
tapTimeout = setTimeout(function() {
// trigger universal 'tap' with the option to cancelTouch()
// (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
var event = jQuery.Event('tap')
event.cancelTouch = cancelAll
// [by paper] fix -> "TypeError: 'undefined' is not an object (evaluating 'touch.el.trigger'), when double tap
if (touch.el) touch.el.trigger(event)
// trigger double tap immediately
if (touch.isDoubleTap) {
if (touch.el) touch.el.trigger('doubleTap')
touch = {}
}
// trigger single tap after 250ms of inactivity
else {
touchTimeout = setTimeout(function(){
touchTimeout = null
if (touch.el) touch.el.trigger('singleTap')
touch = {}
}, 250)
}
}, 0)
} else {
touch = {}
}
deltaX = deltaY = 0
}
jQuery(document).on(eventMap.up, up)
.on(eventMap.down, down)
.on(eventMap.move, move)
// when the browser window loses focus,
// for example when a modal dialog is shown,
// cancel all ongoing events
jQuery(document).on(eventMap.cancel, cancelAll)
// scrolling the window indicates intention of the user
// to scroll, not tap or swipe, so cancel all ongoing events
jQuery(window).on('scroll', cancelAll)
initialized = true
}
;['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown',
'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
jQuery.fn[eventName] = function(callback){return this.on(eventName, callback) }
/*jQuery.fn[eventName] = function(callback){
return jQuery(document).off(eventName).on(eventName,this,callback)
}*/
})
jQuery.touch = { setup: setup }
jQuery(document).ready(setup)
})(jQuery)

File diff suppressed because one or more lines are too long

2122
static/jquery_weui/js/iscroll.js vendored Normal file

File diff suppressed because it is too large Load Diff

6441
static/jquery_weui/js/jquery-weui.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

89
static/jquery_weui/js/navbarscroll.js vendored Normal file
View File

@@ -0,0 +1,89 @@
/*
* 移动端模拟导航可点击自动滑动 0.1.4
* Date: 2017-01-11
* by: xiewei
* 导航可左右滑动可点击边缘的一个自动滚动下一个到可视范围【依赖于iscroll.js】
*/
(function ($) {
$.fn.navbarscroll = function (options) {
//各种属性、参数
var _defaults = {
className:'cur', //当前选中点击元素的class类名
clickScrollTime:300, //点击后滑动时间
duibiScreenWidth:0.4, //单位以rem为准默认为0.4rem
scrollerWidth:3, //单位以px为准默认为3,[仅用于特殊情况:外层宽度因为小数点造成的不精准情况]
defaultSelect:0-1, //初始选中第n个默认第0个
fingerClick:0, //目标第0或1个选项触发,必须每一项长度一致,方可用此项
endClickScroll:function(thisObj){}//回调函数
}
var _opt = $.extend(_defaults, options);
this.each(function () {
//插件实现代码
var _wrapper = $(this);
var _win = $(window);
var _win_width = _win.width(),_wrapper_width = _wrapper.width(),_wrapper_off_left = _wrapper.offset().left;
var _wrapper_off_right=_win_width-_wrapper_off_left-_wrapper_width;
var _obj_scroller = _wrapper.children('.scroller');
var _obj_ul = _obj_scroller.children('ul');
var _obj_li = _obj_ul.children('li');
var _scroller_w = 0;
_obj_li.css({"margin-left":"0","margin-right":"0"});
for (var i = 0; i < _obj_li.length; i++) {
_scroller_w += _obj_li[i].offsetWidth;
}
_obj_scroller.width(_scroller_w+_opt.scrollerWidth);
var myScroll = new IScroll('#'+_wrapper.attr('id'), {
eventPassthrough: true,
scrollX: true,
scrollY: false,
preventDefault: false
});
_init(_obj_li.eq(_opt.defaultSelect));
_obj_li.click(function(){
_init($(this));
});
//解决PC端谷歌浏览器模拟的手机屏幕出现莫名的卡顿现象滑动时禁止默认事件2017-01-11
_wrapper[0].addEventListener('touchmove',function (e){e.preventDefault();},false);
function _init(thiObj){
var $this_obj=thiObj;
var duibi=_opt.duibiScreenWidth*_win_width/10,this_index=$this_obj.index(),this_off_left=$this_obj.offset().left,this_pos_left=$this_obj.position().left,this_width=$this_obj.width(),this_prev_width=$this_obj.prev('li').width(),this_next_width=$this_obj.next('li').width();
var this_off_right=_win_width-this_off_left-this_width;
if(_scroller_w+2>_wrapper_width){
if(_opt.fingerClick==1){
if(this_index==1){
myScroll.scrollTo(-this_pos_left+this_prev_width,0, _opt.clickScrollTime);
}else if(this_index==0){
myScroll.scrollTo(-this_pos_left,0, _opt.clickScrollTime);
}else if(this_index==_obj_li.length-2){
myScroll.scrollBy(this_off_right-_wrapper_off_right-this_width,0, _opt.clickScrollTime);
}else if(this_index==_obj_li.length-1){
myScroll.scrollBy(this_off_right-_wrapper_off_right,0, _opt.clickScrollTime);
}else{
if(this_off_left-_wrapper_off_left-(this_width*_opt.fingerClick)<duibi){
myScroll.scrollTo(-this_pos_left+this_prev_width+(this_width*_opt.fingerClick),0, _opt.clickScrollTime);
}else if(this_off_right-_wrapper_off_right-(this_width*_opt.fingerClick)<duibi){
myScroll.scrollBy(this_off_right-this_next_width-_wrapper_off_right-(this_width*_opt.fingerClick),0, _opt.clickScrollTime);
}
}
}else{
if(this_index==1){
myScroll.scrollTo(-this_pos_left+this_prev_width,0, _opt.clickScrollTime);
}else if(this_index==_obj_li.length-1){
if(this_off_right-_wrapper_off_right>1||this_off_right-_wrapper_off_right<-1){
myScroll.scrollBy(this_off_right-_wrapper_off_right,0, _opt.clickScrollTime);
}
}else{
if(this_off_left-_wrapper_off_left<duibi){
myScroll.scrollTo(-this_pos_left+this_prev_width,0, _opt.clickScrollTime);
}else if(this_off_right-_wrapper_off_right<duibi){
myScroll.scrollBy(this_off_right-this_next_width-_wrapper_off_right,0, _opt.clickScrollTime);
}
}
}
}
$this_obj.addClass(_opt.className).siblings('li').removeClass(_opt.className);
_opt.endClickScroll.call(this,$this_obj);
}
});
};
})(jQuery);

17
static/jquery_weui/js/swiper.min.js vendored Normal file

File diff suppressed because one or more lines are too long