getData:function(){ var id = location.search.slice(4); var me = this; if(!/\d/.test(id)){ return; } $.ajax({url:url + '&subject=' + id}).done($.proxy(me.fixData,me)); },
function CatList(opts){ //用来判断是否需要重新请求 this.cacheFlag = {}; //用来存储数据 this.cache = {}; this.$tabBdWrap = $(opts.bd); this.$tabHdWrap = $(opts.hd); this.tpl = $(opts.tpl).html(); this.inited = false; getCats.get().then($.proxy(this.getData,this) ); };
getData:function(initTabId){ initTabId && (this.tabId = initTabId) ; var me = this, data ; if(data = this.cacheFlag[this.tabId]){ //已经缓存过 this.renderUi(data); }else{ $.ajax({ url: urls.offlineStatus ? url : url + initTabId + '&t=' + now, beforeSend:function(){ me.$tabBdWrap.find('.cat-bd-' + initTabId).html('<div class="loading"></div>'); } }).done($.proxy(me.fixData,me)); } },
Modal.prototype.open = function(relatedTarget) { var $element = this.$element; var options = this.options; var isPopup = this.isPopup; var width = options.width; var height = options.height; var style = {}; if (this.active) { return; } if (!this.$element.length) { return; } // callback hook relatedTarget && (this.relatedTarget = relatedTarget); // 判断如果还在动画,就先触发之前的closed事件 if (this.transitioning) { clearTimeout($element.transitionEndTimmer); $element.transitionEndTimmer = null; $element.trigger(options.transitionEnd) .off(options.transitionEnd); } isPopup && this.$element.show(); this.active = true; $element.trigger($.Event('open.modal.amui', {relatedTarget: relatedTarget})); this.dimmer.open($element); $element.show().redraw(); // apply Modal width/height if set if (!isPopup && !this.isActions) { if (width) { style.width = parseInt(width, 10) + 'px'; } if (height) { style.height = parseInt(height, 10) + 'px'; } this.$dialog.css(style); } $element .removeClass(options.className.out) .addClass(options.className.active); this.transitioning = 1; var complete = function() { $element.trigger($.Event('opened.modal.amui', { relatedTarget: relatedTarget })); this.transitioning = 0; // Prompt auto focus if (this.isPrompt) { this.$dialog.find('input').eq(0).focus(); } }; if (!supportTransition) { return complete.call(this); } $element .one(options.transitionEnd, $.proxy(complete, this)) .emulateTransitionEnd(options.duration); };
this.makePoly = function(layerConfig){ var stylePromise = new $.Deferred(); var themeName = layerConfig.display; var hex2rgba = $.proxy(this.hex2rgba, this); if(themeName === '_all'){ var theStyle = function(){ this.styleFunction = function(feature){ var style = new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#CCC', width: 3 }), fill: new ol.style.Fill({ color: 'rgba(60, 60, 60, 0.3)' }) }); return style; } } stylePromise.resolve(new theStyle()); } else { var theTheme; $.map(layerConfig.themes, function(theme){ if(theme.alias === themeName){ theTheme = theme; } }); var classPromise = theTheme.exact ? this.getKeys(layerConfig.name, theTheme.key): this.makeBreaks(layerConfig.name, theTheme); var colors = theTheme.exact ? [].concat.apply([], [cb[theTheme.set+'1']['8'], cb[theTheme.set+'2']['8']]): cb[theTheme.set]['5']; $.when(classPromise).done(function(classes){ /** * @param {Object} theTheme - child of layer style config * @param {Array<String>}{d3.scale.qunatile} classes * @param {Array<string>} colors */ var theStyle = function(theTheme, classes, colors){ this.theme = theTheme; this.classes = classes; this.colors = colors; /** * @param {ol.feature.Vector} feature * @return {ol.style.Style} style */ this.styleFunction = function(feature){ var val = feature.getProperties()[this.theme.key]; var color = this.makeColors(val); var style = new ol.style.Style({ stroke: new ol.style.Stroke({ color: color, width: 3 }), fill: new ol.style.Fill({ color: hex2rgba(color, 0.4) }) }); return style; } /** * @param {String}{Number} val * @return {String} color in hex */ this.makeColors = function(val){ if(theTheme.exact){ var index = $.inArray(val, this.classes); return this.colors[index]; } else { return this.classes(val); } } } stylePromise.resolve(new theStyle(theTheme, classes, colors)); }) } return stylePromise.promise(); }
Glide.prototype.events = function() { /** * Swipe * If swipe option is true * Attach touch events */ if (this.options.touchDistance) { this.parent.on({ 'touchstart MSPointerDown': $.proxy(this.events.touchstart, this), 'touchmove MSPointerMove': $.proxy(this.events.touchmove, this), 'touchend MSPointerUp': $.proxy(this.events.touchend, this) }); } /** * Arrows * If arrows exists * Attach click event */ if (this.arrows.wrapper) { $(this.arrows.wrapper).children().on('click touchstart', $.proxy(this.events.arrows, this) ); } /** * Navigation * If navigation exists * Attach click event */ if (this.navigation.wrapper) { $(this.navigation.wrapper).children().on('click touchstart', $.proxy(this.events.navigation, this) ); } /** * Keyboard * If keyboard option is true * Attach press event */ if (this.options.keyboard) { $(document).on('keyup.glideKeyup', $.proxy(this.events.keyboard, this) ); } /** * Slider hover * If hover option is true * Attach hover event */ if (this.options.hoverpause) { this.parent.on('mouseover mouseout', $.proxy(this.events.hover, this) ); } /** * Slider resize * On window resize * Attach resize event */ $(window).on('resize', $.proxy(this.events.resize, this) ); };
hostname+this._options.context.page.link;if(typeof xtor==="string"&&xtor!=="")url+="#xtor="+xtor;if(typeof urlencode==="boolean")if(urlencode===false)return url;return encodeURI(url)},parse:function(selector){selector=selector||"body";$(selector).find(".toolbar").unspin().append(this.$el).show()},_addSpin:function(){$(".toolbar").spin({height:30,width:534,spRadius:5,spWidth:2,spLength:3,spLines:12})},init:function(options){this._options=options;this.render().done($.proxy(this.parse,this))}}});
return this.ranges.map(function(range) { return range.val().map($.proxy(self.normalise, self)); });
//Deferred <T> (beforeStart?: (deferred: JQueryDeferred <T> ) => any): JQueryDeferred <T> ; //easing: JQueryEasingFunctions; //fx: {tick: () => void; interval: number; stop: () => void; speeds: {slow: number;fast: number;}; off: boolean; step: any;}; //proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; //proxy(context: Object, name: string, ...additionalArguments: any[]): any; const testProxyContext = { name: 'John', test: function() { $('#log').append(this.name); $('#test').off('click', testProxyContext.test); } }; $('#test').on('click', $.proxy(testProxyContext, 'test')); //Event: JQueryEventConstructor; //error(message: any): JQuery; $('#book').error(function() { alert('Handler for .error() called.'); }); //expr: any; //fn: any; const testFN = $.fn; // DEPRECATED isReady: boolean; // DEPRECATED support: JQuerySupport;
getURL: function() { var url = this.options.url; return ( typeof url === 'function' ) ? $.proxy(url, this)() : url; },
init: function() { $('.open',this).click($.proxy(this.openCatalogDialog,this)) },
activate: function (control) { this.$parent(control); this.control = control; this.submit = $.proxy(this.submit, this); control.once('afterrender', $.proxy(this.bindEvents, this)); },
var Pillbox = function (element, options) { this.$element = $(element); this.options = $.extend({}, $.fn.pillbox.defaults, options); this.$element.on('click', 'li', $.proxy(this.itemclicked, this)); };
return function(additionalOptions) { _.extend(options, additionalOptions || {}); var reloadRequired = Boolean(options.reloadRequired); var button = options._sourceElement; button.click($.proxy(onClick, null, reloadRequired)); };
this.isOpen=false},create:function(){var self=this;this.bouton=$("<div>").addClass(config.el.substr(1)).hide();var i;$.getJSON(ws,null,"jsonp");$(config.wrapper).append(this.bouton);this.bouton.fadeIn("fast");this.isHide=false;$(config.wrapper+" p").each(function(index){if($.trim($(this).html())!==""){i=index;return false}});if(i!=null)this.limitTop=$(config.wrapper+" p:eq("+i+")").offset().top;this.limitBottom=this.limitTop+$(config.wrapper).height();this.isOpen=false;this.adjust();if(auth.authenticated)auth.loadUser().done(function(){if(auth.user.abonne=== true)self.bouton.on("click",$.proxy(self.open,self))});$(window).on("scroll",$.proxy(this.adjust,this))},adjust:function(){var bouton=$(config.el),position=$(window).scrollTop(),left=$(config.wrapper).parent().offset().left-55;if(!this.isOpen)if(position<=this.limitBottom-config.bottomPos){if(this.isHide){bouton.fadeIn("fast");this.isHide=false}if(position<=this.limitTop-config.topPos)bouton.css({top:this.limitTop-position,left:left});else bouton.css({top:config.topPos,left:left})}else{bouton.fadeOut("fast");
this),$(".annotation",this));var form=this;self.afficherNbRestant(this,".num_reaction",self.num_reaction+1);$("[name=signature]").data("default",self.signature).val(self.signature);$(this).on("submit",function(event){event.preventDefault();event.stopPropagation();var data=$(this).serialize();$.post("/ws/1/reaction/valider/",data,"json").done($.proxy(function(response){if(response.error===true&&response.message.length>0){$(".erreur",this).html(response.message).show();return}$(".erreur",this).hide(); $(".confirmation",this).show()},this))});$(".modifier, .annuler",form).off("click");$(".modifier, .annuler",form).on("click",function(){var $input=$("[name=signature]",form);$(".modifier, .annuler, .alerte",form).toggle();if(typeof $input.attr("readonly")!=="undefined"){$input.removeAttr("readonly");$input.val("").focus()}else{$input.attr("readonly","readonly");$input.val($input.data("default"))}});$(".confirmation",this).off("click");$(".confirmation",form).on("click",".fermer",function(){$(this).closest(".confirmation").hide()});
hideMenu(callback) { callback = callback || function() {}; $(".start-screen").fadeOut(500, $.proxy(callback, this)); $("body").addClass("in-game"); }
dropDownFunc: function(){ this.drop.on('mouseover', $.proxy(this.dropMouseOver, this)); this.drop.on('mouseout', $.proxy(this.dropMouseOut, this)); this.dropDown.on('mouseover', $.proxy(this.dropMouseOver, this)); this.dropDown.on('mouseout', $.proxy(this.dropMouseOut, this)); },
var DragEvent = function () { this.start = $.proxy(this.start, this); this.over = $.proxy(this.over, this); this.end = $.proxy(this.end, this); this.onstart = this.onover = this.onend = $.noop; };
createButton: function(){ if(this.parentNode){ this.button = $('<div id="toggleButton"></div>').on('click', $.proxy(this.toggle, this)); this.parentNode.append(this.button); } },
getOption: function(name) { var option = this.options[name]; return (typeof option === 'function') ? $.proxy(option, this)() : option; },
clearValues: function() { $.each(this.fields, $.proxy(function(i, f) { f.clearValue(); }, this)); },
show: function (anchor) { if (this.destroyed) { return this; } var that = this; var popup = this.__popup; var backdrop = this.__backdrop; this.__activeElement = this.__getActive(); this.open = true; this.follow = anchor || this.follow; // 初始化 show 方法 if (!this.__ready) { popup .addClass(this.className) .attr('role', this.modal ? 'alertdialog' : 'dialog') .css('position', this.fixed ? 'fixed' : 'absolute'); if (!_isIE6) { $(window).on('resize', $.proxy(this.reset, this)); } // 模态浮层的遮罩 if (this.modal) { var backdropCss = { position: 'fixed', left: 0, top: 0, width: '100%', height: '100%', overflow: 'hidden', userSelect: 'none', zIndex: this.zIndex || Popup.zIndex }; popup.addClass(this.className + '-modal'); if (!_isFixed) { $.extend(backdropCss, { position: 'absolute', width: $(window).width() + 'px', height: $(document).height() + 'px' }); } backdrop .css(backdropCss) .attr({tabindex: '0'}) .on('focus', $.proxy(this.focus, this)); // 锁定 tab 的焦点操作 this.__mask = backdrop .clone(true) .attr('style', '') .insertAfter(popup); backdrop .addClass(this.className + '-backdrop') .insertBefore(popup); this.__ready = true; } if (!popup.html()) { popup.html(this.innerHTML); } } popup .addClass(this.className + '-show') .show(); backdrop.show(); this.reset().focus(); this.__dispatchEvent('show'); return this; },
alltoolbar.find(".outil.classer").addClass("actif");confirmationMessage="Cet \u00e9l\u00e9ment a bien \u00e9t\u00e9 ajout\u00e9 \u00e0 vos favoris."}toolbar.find(".confirmation .message").html(confirmationMessage).show();toolbar.find(".confirmation").show()},_callToggleFavApi:function(mode){if(auth.user.newId!=null){var url="/sfuser/sfws/user/classeur/"+mode+"/$1";var userId=encodeURIComponent(auth.user.newId);url=url.replace("$1",this._options.context.item.cms_id);$.get(url,"userId="+userId,null, "json").done($.proxy(auth.refresh,auth))}else{var data={};var jsonParams;data.mode="add_elem";data.item_id=this._options.context.item.id;jsonParams="params="+JSON.stringify(data);$.get("/api/1/user/classeur/",jsonParams,null,"json").done($.proxy(auth.refresh,auth))}},_initReagir:function(){if(typeof this._options.reagir!=="undefined"&&typeof this._options.reagir.active!=="undefined"&&this._options.reagir.active===false){this.$el.find(".outil.reagir").hide();return}this.$el.find(".outil.reagir").on("click",
var processRAF = function() { UI.utils.rAF.call(window, $.proxy(this.process, this)); }.bind(this);
undefined&&this._options.imprimer.active===false||context.item!==undefined&&context.item.type!==undefined&&context.item.type.nom!==undefined&&(context.item.type.nom==="video"||context.item.type.nom==="portfolio")){this.$el.find(".outil_imprimer").hide();return}var self=this;this.$el.find(".outil_imprimer").click(function(event){self._xtClick(event.currentTarget,true,"Clic_Imprimez");window.print()})},_initClasser:function(){if(typeof this._options.classer!=="undefined"&&typeof this._options.classer.active!== "undefined"&&this._options.classer.active===false){this.$el.find(".outil.classer").hide();return}if(auth.authenticated&&auth.user&&auth.user.abonne)this._checkFav();this.$el.find(".outil.classer").click($.proxy(this._onClickClasser,this));this.$el.find(".confirmation .fermer").click(function(){$(this).parents(".confirmation").hide()})},_onClickClasser:function(event){var toolbar=$(event.currentTarget).parents(".toolbar");this._xtClick(event.currentTarget,true,"Clic_Classer");if(!auth.authenticated||
KBWidget = function (def) { def = (def || {}); var name = def.name; var parent = def.parent; if (parent == undefined) { parent = 'kbaseWidget'; } var asPlugin = def.asPlugin; if (asPlugin === undefined) { asPlugin = true; } var Widget = function ($elem) { this.$elem = $elem; this.options = $.extend(true, {}, def.options, this.constructor.prototype.options); return this; }; if (name) { var directName = name; directName = directName.replace(/^kbase/, ''); directName = directName.charAt(0).toLowerCase() + directName.slice(1); KBase[directName] = function (options, $elem) { var $w = new Widget(); if ($elem == undefined) { $elem = jqElem('div'); } $w.$elem = $elem; if (options == undefined) { options = {}; } options.headless = true; $w.init(options); $w._init = true; $w.trigger('initialized'); return $w; }; widgetRegistry[name] = Widget; if (def == undefined) { def = parent; parent = 'kbaseWidget'; if (def == undefined) { def = {}; } } } if (parent) { var pWidget = widgetRegistry[parent]; if (pWidget === undefined) throw new Error("Parent widget is not registered. Cannot find " + parent + " for " + name); subclass(Widget, pWidget); } var defCopy = $.extend(true, {}, def); Widget.prototype.__attributes = {}; if (defCopy._accessors != undefined) { //for (var accessor in defCopy._accessors) { $.each( defCopy._accessors, $.proxy(function (idx, accessor) { var info = { name: accessor, setter: accessor, getter: accessor, type: 'rw' }; if (typeof accessor === 'object') { info.setter = accessor.name; info.getter = accessor.name; for (var key in accessor) { info[key] = accessor[key]; } } Widget.prototype.__attributes[info.name] = info; if (info.setter == info.getter && info.type.match(/rw/)) { Widget.prototype[info.getter] = KBase._functions.getter_setter(info.name); } else { if (info.type.match(/w/) && info.setter != undefined) { Widget.prototype[info.setter] = KBase._functions.setter(info.name); } if (info.type.match(/r/) && info.getter != undefined) { Widget.prototype[info.getter] = KBase._functions.getter(info.name); } } }, this) ); defCopy._accessors = undefined; } var extension = $.extend(true, {}, Widget.prototype.__attributes, widgetRegistry[parent].prototype.__attributes); Widget.prototype.__attributes = extension; for (var prop in defCopy) { //hella slick closure based _super method adapted from JQueryUI. //* if ($.isFunction(defCopy[prop])) { Widget.prototype[prop] = (function (methodName, method) { var _super, _superMethod; if (parent) { _super = function () { return widgetRegistry[parent].prototype[methodName].apply(this, arguments); }; _superMethod = function (superMethodName) { return widgetRegistry[parent].prototype[superMethodName].apply(this, Array.prototype.slice.call(arguments, 1)); }; } else { _super = function () { throw "No parent method defined! Play by the rules!"; }; _superMethod = function () { throw "No parent method defined! Play by the rules!"; }; } return function () { var _oSuper = this._super; var _oSuperMethod = this._superMethod; this._super = _super; this._superMethod = _superMethod; var retValue = method.apply(this, arguments); this._super = _oSuper; this._superMethod = _oSuperMethod; return retValue; } })(prop, defCopy[prop]); } else { Widget.prototype[prop] = defCopy[prop]; } } if (parent) { Widget.prototype.options = $.extend(true, {}, widgetRegistry[parent].prototype.options, Widget.prototype.options); } if (asPlugin) { var widgetConstructor = function (method, args) { if (this.length > 1) { var methodArgs = arguments; $.each( this, function (idx, elem) { widgetConstructor.apply($(elem), methodArgs); } ); return this; } if (this.data(name) == undefined) { this.data(name, new Widget(this)); } // Method calling logic if (Widget.prototype[method]) { return Widget.prototype[method].apply( this.data(name), Array.prototype.slice.call(arguments, 1) ); } else if (typeof method === 'object' || !method) { //return this.data(name).init( arguments ); var args = arguments; $w = this.data(name); if ($w._init === undefined) { $w = Widget.prototype.init.apply($w, arguments); } $w._init = true; $w.trigger('initialized'); return $w; } else { $.error('Method ' + method + ' does not exist on ' + name); } return this; }; widgetConstructor.name = name; } /** * Registers events on this element. * @param {String} name The event name to register * @param {Function} callback The function to call when an event is * emitted. */ this.on = function (evt, callback) { this.$elem.bind(evt, callback); return this; }; /** * Emits an event. * @param {String} name The event name * @param {Object} data The data to emit with the event */ this.emit = function (evt, data) { this.$elem.trigger(evt, data); return this; }; /** * Unregisters events on this element. * @param {String} name The event name to unregister from */ this.off = function (evt) { this.$elem.unbind(evt); return this; }; if (name !== undefined) { Widget.prototype[name] = function () { return widgetConstructor.apply(this.$elem, arguments); }; return widgetConstructor; } else { return this; } };
"json").done($.proxy(auth.refresh,auth))}else{var data={};var jsonParams;data.mode="add_elem";data.item_id=this._options.context.item.id;jsonParams="params="+JSON.stringify(data);$.get("/api/1/user/classeur/",jsonParams,null,"json").done($.proxy(auth.refresh,auth))}},_initReagir:function(){if(typeof this._options.reagir!=="undefined"&&typeof this._options.reagir.active!=="undefined"&&this._options.reagir.active===false){this.$el.find(".outil.reagir").hide();return}this.$el.find(".outil.reagir").on("click", $.proxy(this._onClickReagir,this))},_onClickReagir:function(event){$(event.currentTarget).parents(".toolbar");this._xtClick(event.currentTarget,true,"Clic_Reagir");if(typeof this._options.reagir!=="undefined"&&typeof this._options.reagir.link!=="undefined")window.open(this._options.reagir.link,"_blank")},_initAbonnezVous:function(){if(typeof this._options.abonnez_vous!=="undefined"&&typeof this._options.abonnez_vous.active!=="undefined"&&this._options.abonnez_vous.active===false)return;if(!auth.authenticated||
return function(additionalOptions) { _.extend(options, additionalOptions || {}); var button; button = options._sourceElement; button.click($.proxy(onClick, null)); };
null){this._renderDeferred=$.Deferred();auth.loadUser().done($.proxy(function(){sharing.getFacebookLikes().done($.proxy(function(facebookLikes){if(facebookLikes>0)facebookLikes=sharing.formatCounter(facebookLikes);else facebookLikes=false;var params={"facebook_likes":facebookLikes};if(this._options.aboLabel!==undefined)params.aboLabel=this._options.aboLabel;if(this._options.loginPartial!==undefined)params.loginPartial=this._options.loginPartial;this.$el=$(template.render(params));this._initSharing(); this._initEnvoyer();this._initImprimer();this._initClasser();this._initReagir();this._initAbonnezVous();this._renderDeferred.resolve()},this))},this))}return this._renderDeferred.promise()},_initSharing:function(partage){var self=this;var link;this.$el.find(".partage .facebook").click(function(event){link=partage||self._getPageUrl("",false);facebook.load().done(function(){FB.ui({method:"feed",link:link,picture:""})});self._xtSocial(event.currentTarget,".partage .facebook","Facebook")});this.$el.find(".partage .twitter").click(function(event){var baseUrl=