Ejemplo n.º 1
0
		require.async('qqapi', function (mqq) {
			if (T.isValidMQQ(mqq)) {
				var o = $.extend({}, defaultOpt, opts);
				if(mqq.compare("4.7.2") !== -1){
					var shareParams = that.getMQQParams(o);
					o.beforeMQQShare && (shareParams = o.beforeMQQShare(shareParams));
					//fix 微信朋友圈
					var shareParams2 = $.extend({}, shareParams);
					shareParams2.otitle = shareParams2.otitle;
					shareParams2.title = shareParams2.desc;
					o.beforeMQQShareTimeline && (shareParams2 = o.beforeMQQShareTimeline(shareParams2));
					mqq.ui.setOnShareHandler(function (type) {
						//type: 0:QQ好友;1:QQ空间;2:微信好友;3:微信朋友圈。默认为 0
						o.onMQQShareBtnClick && o.onMQQShareBtnClick(type);
						mqq.ui.shareMessage($.extend({}, type==3?shareParams2:shareParams, {share_type: type}), function (result) {
							//result.retCode: 0: 完成 1: 取消
							o.onMQQShare && o.onMQQShare(result, type);
						});
					});
				}else if(mqq.compare("4.6") !== -1){
					var shareParams = that.getMQQParams(o);
					o.beforeMQQShare && (shareParams = o.beforeMQQShare(shareParams));
					mqq.data.setShareInfo(shareParams, function() {
						o.onMQQShare && o.onMQQShare(); //IOS不支持此回调
					});
				}else{
					//用户版本太低,我没办法了...
				}
			}
		});
Ejemplo n.º 2
0
 $('body').on('locationReady', function(e, data) { //定位完成
     $.extend(self.cacheData, data);
     self.params = $.extend({
         popRoot: 'no'
     }, self.cacheData.params);
     self.loadData();
 }).on('procinceChanged', function(e, data) { //省份切换完成
Ejemplo n.º 3
0
        getCustom = function(key,data){

            if(data){
                if (key == "share_sms") {
                    data = {
                        content: [
                            data.title,
                            " ",
                            data.content,
                            data.url
                        ].join("")
                    }
                }

                if(key == "share_weibo") {
                    $.extend(data,{
                        content:[
                            "@跟谁学 ",
                            data.title,
                            data.content,
                            data.url,
                            " #找好老师,上跟谁学#"
                        ].join("")
                    });
                }
            }

            return data;
        };
Ejemplo n.º 4
0
    var Panel = function(options){
    	var defaultOptions = {
    		targetContent : '',
    		displayMode : 'push',
    		direction : 'left',
    		autoDismiss : true
    	}

        //扩展options
    	this.options = $.extend(defaultOptions, options);

        //Panel对象
        this.el = arguments[0].ref;

        //Content对象
        this.cont = this.options.targetContent;

        //Panel宽度
        this.width = ($(this.el).width() === 0 ? window.innerWidth : $(this.el).width());

        //Panel打开状态,默认为false(关闭)
        this.isOpen = false;

        //初始化
        this.init();
    }
Ejemplo n.º 5
0
    var Share = function (opt) {
        // 参数校验并设置默认值
        this.opt = $.extend({}, defaultOpt, opt);
        if (!this.opt.content) {
            this.opt.content = this.opt.title;
        }
        if (/^\/\/.+/.test(this.opt.url)) {
            this.opt.url = 'http:' + this.opt.url;
        }
        this.opt.linkUrl = this.opt.url;

        if (isWechat) {
            var wechatOptions = {
                title: this.opt.title,
                content: this.opt.content,
                iconUrl: this.opt.iconUrl,
                wx: {
                    api: this.opt.wechatAPI,
                    jsApiList: []
                }
            }
            var wechatShare = new shareConfig(wechatOptions);
        }
        
        // init
        this._init();
    };
Ejemplo n.º 6
0
        send: function(ps){
            ps = $.extend(this._localStoryParams,this.params,ps||{});

            var url = "http://click.genshuixue.com/gs.gif?"+ $.param(ps);

            this.img.src = url;
        }
Ejemplo n.º 7
0
 var Alert = function(el, option, isFromTpl) {
     this.$el = $(el);
     this._isFromTpl = isFromTpl;
     this.option = $.extend(defaults, option);
     this.button = this.$el.find(this.option.button);
     this._initEvent();
 };
Ejemplo n.º 8
0
 var Loading = function(el, option, isFromTpl) {
     this.$el = $(el);
     this._isFromTpl = isFromTpl;
     this.option = $.extend(defaults, option);
     this.show();
     return this.$el;
 };
Ejemplo n.º 9
0
 Bridge.Data.getData(function(res) {
     self.params = $.extend(self.params, res);
     self.cacheData.sid = res.sid || self.cacheData.sid;
     self.cacheData.sname = res.sname || self.cacheData.sname;
     delete self.params.sid;
     delete self.params.sname;
     delete res.uid;
     delete res.comppage;
     delete res.oem;
     delete res.channel;
     delete res.cpu;
     delete res.sv;
     delete res.os;
     delete res.resid;
     delete res.mb;
     delete res.net;
     delete res.ctm;
     delete res.glr;
     delete res.bduid;
     delete res.dpi;
     delete res.glv;
     delete res.ver;
     delete res.screen;
     delete res.cuid;
     delete res.c;
     delete res.loc;
     delete res.b;
     delete res.bc;
     delete res.ssid;
     if (Bridge.isBaiduMap()) {
         self.params.ldata = '{"src_from":"zhoumo_promotion","activity_id":"zhoumo_promotion"}';
     }
     self._bind();
     self.loadData();
 });
Ejemplo n.º 10
0
 _bind: function() {
     var self = this,
         _params = $.extend({
             popRoot: 'no'
         }, self.params);
     $('body').on('tap', '.J-item', function() { //进入poi详情页
         var uid = $(this).data('uid'),
             td_id = $(this).data('td_id');
         Bridge.pushWindow({
             page: 'poiDetail',
             data: {
                 nuomi: $.extend({
                     td_id: td_id
                 }, _params),
                 map: $.extend({
                     'uid': uid
                 }, _params),
                 'nuomi-webapp': $.extend({
                     td_id: td_id
                 }, _params),
                 'map-webapp': $.extend({
                     uid: uid,
                     qt: 'ninf',
                     industry: 'scope'
                 }, _params)
             }
         });
     });
 },
Ejemplo n.º 11
0
function zRefresh(opt){
	if(!(this instanceof zRefresh)){
		return new zRefresh(opt);
	}
	this.opt = $.extend({}, config, opt);
	this.init();
};
Ejemplo n.º 12
0
		getImageMeta(file, function (meta) {

			// if file is a jpeg image,
			// using exif messagees
			// to transform the iamge at right orientation
			if (meta && meta.tiff && meta.tiff.Orientation) {
				param = $.extend({orientation: meta.tiff.Orientation.value}, param);
			}

			var canvas = document.createElement('canvas');

			mpImg.onrender = function () {
				var base64Str = "";
				if ($.os.android && param.type == "image/jpeg") {
					// using jpegEncoder to fix android machine does not support jpeg
					var ctx = canvas.getContext('2d');
					var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
					var encoder = new JPEGEncoder(param.quality * 100);
					base64Str = encoder.encode(imgData);
					encoder = null
				} else {
					base64Str = canvas.toDataURL(picParam.type, picParam.quality);
				}
				callback(base64Str);
			};

			mpImg.render(canvas, param);

		});
Ejemplo n.º 13
0
function Count(cfg){
	if(!(this instanceof Count)){
		return new Count(cfg);
	}
	this.opt = $.extend({}, config, cfg);
	this.init();
};
Ejemplo n.º 14
0
Archivo: select.js Proyecto: zbfe/zui
        constructor: function (options) {
            var self = this;
            var html;

            // 合并参数
            options = $.extend({}, Select.defaults, options);

            // 如果没有data或者为空,则报错
            if (!options.data || !options.data.length) {
                throw new Error('options.data is empty');
            }

            // 拼列表
            html = [
                '<ul class="zui-popup-select-list">'
            ].join('');
            options.data.forEach(function (val) {
                html += [
                    '<li class="zui-popup-select-item">',
                    '   <div class="zui-popup-select-text">' + val.text + '</div>',
                    '</li>'
                ].join('');
            });
            html += [
                '</ul>'
            ].join('');

            // 拼取消按钮
            html += [
                '<div class="zui-popup-select-cancel">',
                '   <div class="zui-popup-select-item">取消</div>',
                '</div>'
            ].join('');

            // 准备弹出来的数据
            options.content = html;

            // 初始化zui
            Select.super.constructor.call(self, options);

            // 点击取消
            self.$wrap.find('.zui-popup-select-cancel').on('click', function () {
                self.trigger('cancel');
                self.close();
            });

            // 点击菜单
            self.$wrap.find('.zui-popup-select-list .zui-popup-select-item').on('click', function () {
                var index = $(this).index();

                self.trigger('select', {
                    index: index,
                    value: self.get('data')[index].value
                });

                self.close();
            });

            html = null;
        }
Ejemplo n.º 15
0
		require.async('qqapi', function (mqq) {
			if (T.isValidMQQ(mqq)) {
				if(mqq.compare("4.7.2") !== -1){
					var shareParams = this.OP.getMQQParams(o);
					o.beforeMQQShare && (shareParams = o.beforeMQQShare(shareParams));
					//fix 微信朋友圈
					var shareParams2 = $.extend({}, shareParams);
					shareParams2.title = shareParams2.desc;
					mqq.ui.shareMessage($.extend(type==3?shareParams2:shareParams, {share_type: type}), function (result) {
						//result.retCode: 0: 完成 1: 取消
						o.onMQQShare && o.onMQQShare(result, type);
					});
				} else {
					cb && cb();
				}
			}
		});
Ejemplo n.º 16
0
					mqq.ui.setOnShareHandler(function (type) {
						//type: 0:QQ好友;1:QQ空间;2:微信好友;3:微信朋友圈。默认为 0
						o.onMQQShareBtnClick && o.onMQQShareBtnClick(type);
						mqq.ui.shareMessage($.extend({}, type==3?shareParams2:shareParams, {share_type: type}), function (result) {
							//result.retCode: 0: 完成 1: 取消
							o.onMQQShare && o.onMQQShare(result, type);
						});
					});
Ejemplo n.º 17
0
 var Dialog = function(el, option, isFromTpl) {
     this.$el = $(el);
     this._isFromTpl = isFromTpl;
     this.option = $.extend(defaults, option);
     this.button = this.$el.find('[role="button"]');
     this._initEvent();
     this.toggle();
 };
Ejemplo n.º 18
0
Archivo: alert.js Proyecto: zbfe/zui
        constructor: function (options) {
            var me = this;

            options = $.extend({}, Alert.defaults, options);

            // 初始化zui
            Alert.super.constructor.call(me, options);
        }
Ejemplo n.º 19
0
 initialize: function (opts) {
     this.opts = $.extend({}, this.defaultOpts, opts);
     this.$dom = $('<div class="full-screen-retry-tip' + (this.opts.noPic ? ' no-pic' : '') + '">');
     this.$dom.html('<p>' + this.opts.word);
     var that = this;
     this.$dom.on('click', function () {
         that.opts.onRetryCb && that.opts.onRetryCb();
     });
 },
Ejemplo n.º 20
0
	WeiXinShareToFriend: function(opts) {
		if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
			var shareParams = this.getWeiXinParams($.extend({}, defaultOpt, opts));
			opts.beforeWeiXinShareToFriend && (shareParams = opts.beforeWeiXinShareToFriend(shareParams));
			WeixinJSBridge.invoke("sendAppMessage", shareParams, function (res) {
				opts.onShareWeiXinFriend && opts.onShareWeiXinFriend(res);
			});
		}
	},
Ejemplo n.º 21
0
	init: function(opts) {
		this.opts = $.extend({}, defaultOpts, opts);
		this.$box = this.opts.$box;

		this.$wrapper = $('<div class="scrollBar-warpper"></div>');
		this.$bar = $('<span class="bar"></span>').insertAfter(this.$box.addClass('scrollBar').wrap(this.$wrapper));

		this.refresh();
		this.bindEvents();
	},
Ejemplo n.º 22
0
 Bridge.Data.getData(function (res) {
     delete res.url;
     var _param = $.extend({
         ext_from: window.eventId
     }, res);
     var data = $.extend({
         td_id: td_id,
         uid : uid,
         ticket_id : ticket_id
     }, _param);
     Bridge.pushWindow({
         'page' : 'poiDetail',
         'data' : {
             'nuomi' : data,
             'map' : data,
             'nuomi-webapp' : data,
             'map-webapp' : data
         }
     });
 });
Ejemplo n.º 23
0
 setTimeout(function() {
     if (self.gps == 0) { //定位失败
         Bridge.toast('亲~定位失败了哟~~~');
     }
     Bridge.pushWindow({
         page: 'poiList',
         data: {
             nuomi: $.extend({
                 sid: _sid,
                 tag_id: 0
             }, self.params),
             'nuomi-webapp': $.extend({
                 sid: _sid
             }, self.params),
             'map-webapp': $.extend({
                 c: _cityid
             }, self.params)
         }
     });
 }, _timeout);
Ejemplo n.º 24
0
function InputNumber(opt){
	this.options = $.extend({
		dom : null,
		max : '',
		min : '',
		step : '',
		val : '',
		className : ''
	}, opt || {});

	this.init();
}
Ejemplo n.º 25
0
	WeiXinShareToTimeline: function(opts) {
		if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
			var shareParams = this.getWeiXinParams($.extend({}, defaultOpt, opts));
			//朋友圈默认不显示desc,需要fix
			shareParams.otitle = shareParams.title;
			shareParams.title = shareParams.desc;
			opts.beforeWeiXinShareTimeline && (shareParams = opts.beforeWeiXinShareTimeline(shareParams));
			WeixinJSBridge.invoke("shareTimeline", shareParams, function (res) {
				opts.onShareWeiXinTimeline && opts.onShareWeiXinTimeline(res);
			});
		}
	},
Ejemplo n.º 26
0
	init: function(opts) {  //幂等函数
		if (!this.__init__) this.initDefaultOpt();
		this.opts = $.extend({flag:share.FLAG_MQQ+share.FLAG_WEIXIN}, opts);
		var i = this.FLAG_MQQ;
		while(OP[i]) {
			if (this.opts.flag & i) {
				OP[i](this.opts);
			}
			i = i << 1;
		}
		this.__init__ = true;
	},
Ejemplo n.º 27
0
    $.adaptObject =  function (element, defaults, option,template,plugin,pluginName) {
        var $this= element;
        //isFromTpl = isFromTpl == undefined ? true : false;
        var isFromTpl = false;
        //var selector = $this.selector;
        //var matches = selector.match(/^#(\w*)/);
        //var id = null;
        //matches && matches[1] && (id = matches[1]);

        if (typeof option != 'string'){

            // 获得配置信息
            var context=$.extend({}, defaults,  typeof option == 'object' && option);

            //var isFromTpl=false;
            // 如果传入script标签的选择器
            if($.isArray($this) && $this.length && $($this)[0].nodeName.toLowerCase()=="script"){
                // 根据模板获得对象并插入到body中
                $this=$($.tpl($this[0].innerHTML,context)).appendTo("body");
                isFromTpl=true;
            }
            // 如果传入模板字符串
            else if($.isArray($this) && $this.length && $this.selector== ""){
                // 根据模板获得对象并插入到body中
                $this=$($.tpl($this[0].outerHTML,context)).appendTo("body");
                isFromTpl=true;
            }
            // 如果通过$.dialog()的方式调用
            else if(!$.isArray($this)){
                // 根据模板获得对象并插入到body中
                $this=$($.tpl(template,context)).appendTo("body");
                isFromTpl=true;
            }

            //if(!!id) $this[0].id = id;
        }

        return $this.each(function () {

            var el = $(this);
            // 读取对象缓存

            var data  = el.data('fm.'+pluginName);

            if (!data) el.data('fm.'+pluginName,
                (data = new plugin(this,$.extend({}, defaults,  typeof option == 'object' && option),isFromTpl)

                ));

            if (typeof option == 'string') data[option]();
        })
    };
Ejemplo n.º 28
0
        fill = function(options,rstore){
            var commons = {
                url: options.url || "",
                title: options.title || "",
                content: options.content || "",
                img: options.img || ""
            };

            $.each(shareType,function(index,shareto){
                options[shareto] = $.extend({},commons,options[shareto] || {});
            });

            $.extend(rstore||store,options);
        },
Ejemplo n.º 29
0
        return $this.each(function () {

            var el = $(this);
            // 读取对象缓存

            var data  = el.data('fm.'+pluginName);

            if (!data) el.data('fm.'+pluginName,
                (data = new plugin(this,$.extend({}, defaults,  typeof option == 'object' && option),isFromTpl)

                ));

            if (typeof option == 'string') data[option]();
        })
Ejemplo n.º 30
0
    var Share = function (opt) {
        // 参数校验并设置默认值
        this.opt = $.extend({}, defaultOpt, opt);
        if (!this.opt.content) {
            this.opt.content = this.opt.title;
        }
        if (/^\/\/.+/.test(this.opt.url)) {
            this.opt.url = 'http:' + this.opt.url;
        }
        this.opt.linkUrl = this.opt.url;

        // init
        this._init();
    };