How to use jQuery.queue method in Cypress

Best JavaScript code snippet using cypress

jquery.d.ts.js

Source:jquery.d.ts.js Github

copy

Full Screen

1// Typing for the jQuery library, version 1.102/* Interface for the AJAX setting that will configure the AJAX request */3interface JQueryAjaxSettings {4 accepts?: any;5 async?: boolean;6 beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any;7 cache?: boolean;8 complete? (jqXHR: JQueryXHR, textStatus: string): any;9 contents?: { [key: string]: any; };10 contentType?: any;11 context?: any;12 converters?: { [key: string]: any; };13 crossDomain?: boolean;14 data?: any;15 dataFilter? (data: any, ty: any): any;16 dataType?: string;17 error? (jqXHR: JQueryXHR, textStatus: string, errorThrow: string): any;18 global?: boolean;19 headers?: { [key: string]: any; };20 ifModified?: boolean;21 isLocal?: boolean;22 jsonp?: string;23 jsonpCallback?: any;24 mimeType?: string;25 password?: string;26 processData?: boolean;27 scriptCharset?: string;28 statusCode?: { [key: string]: any; };29 success? (data: any, textStatus: string, jqXHR: JQueryXHR): any;30 timeout?: number;31 traditional?: boolean;32 type?: string;33 url?: string;34 username?: string;35 xhr?: any;36 xhrFields?: { [key: string]: any; };37}38/* Interface for the jqXHR object */39interface JQueryXHR extends XMLHttpRequest {40 overrideMimeType(): any;41}42/* Interface for the JQuery callback */43interface JQueryCallback {44 add(...callbacks: any[]): any;45 disable(): any;46 empty(): any;47 fire(...arguments: any[]): any;48 fired(): boolean;49 fireWith(context: any, ...args: any[]): any;50 has(callback: any): boolean;51 lock(): any;52 locked(): boolean;53 removed(...callbacks: any[]): any;54}55/* Interface for the JQuery promise, part of callbacks */56interface JQueryPromise {57 always(...alwaysCallbacks: any[]): JQueryDeferred;58 done(...doneCallbacks: any[]): JQueryDeferred;59 fail(...failCallbacks: any[]): JQueryDeferred;60 pipe(doneFilter?: (x: any) => any, 61 failFilter?: (x: any) => any, 62 progressFilter?: (x: any) => any): JQueryPromise;63 then(doneCallbacks: any, failCallbacks: any, progressCallbacks?: any): JQueryDeferred;64}65/* Interface for the JQuery deferred, part of callbacks */66interface JQueryDeferred extends JQueryPromise {67 notify(...args: any[]): JQueryDeferred;68 notifyWith(context: any, ...args: any[]): JQueryDeferred;69 progress(...progressCallbacks: any[]): JQueryDeferred;70 reject(...args: any[]): JQueryDeferred;71 rejectWith(context: any, ...args: any[]): JQueryDeferred;72 resolve(...args: any[]): JQueryDeferred;73 resolveWith(context: any, ...args: any[]): JQueryDeferred;74 state(): string;75 then(doneCallbacks: any, failCallbacks?: any, progressCallbacks?: any): JQueryDeferred;76}77/* Interface of the JQuery extension of the W3C event object */78interface JQueryEventObject extends Event {79 data: any;80 delegateTarget: Element;81 isDefaultPrevented(): boolean;82 isImmediatePropogationStopped(): boolean;83 isPropogationStopped(): boolean;84 namespace: string;85 preventDefault(): any;86 relatedTarget: Element;87 result: any;88 stopImmediatePropagation(): void;89 stopPropagation(): void;90 pageX: number;91 pageY: number;92 which: number;93 metaKey: any;94}95/* Collection of properties of the current browser */96interface JQueryBrowserInfo {97 safari: boolean;98 opera: boolean;99 msie: boolean;100 mozilla: boolean;101 version: string;102}103interface JQuerySupport {104 ajax?: boolean;105 boxModel?: boolean;106 changeBubbles?: boolean;107 checkClone?: boolean;108 checkOn?: boolean;109 cors?: boolean;110 cssFloat?: boolean;111 hrefNormalized?: boolean;112 htmlSerialize?: boolean;113 leadingWhitespace?: boolean;114 noCloneChecked?: boolean;115 noCloneEvent?: boolean;116 opacity?: boolean;117 optDisabled?: boolean;118 optSelected?: boolean;119 scriptEval? (): boolean;120 style?: boolean;121 submitBubbles?: boolean;122 tbody?: boolean;123}124interface JQueryTransport {125 send(headers: { [index: string]: string; }, 126 completeCallback: (status: number, statusText: string, 127 responses: { [dataType: string]: any; }, headers: string) => void): void;128 abort(): void;129}130/* Static members of jQuery (those on $ and jQuery themselves) */131interface JQueryStatic {132 // AJAX133 ajax(settings: JQueryAjaxSettings): JQueryXHR;134 ajax(url: string, settings: JQueryAjaxSettings): JQueryXHR;135 ajaxPrefilter(handler: (opts: any, originalOpts: any, jqXHR: JQueryXHR) => any): any;136 ajaxPrefilter(dataTypes: string, 137 handler: (opts: any, originalOpts: any, jqXHR: JQueryXHR) => any): any;138 ajaxSetup(options: any): void;139 ajaxTransport(dataType: string, 140 handler: (options: JQueryAjaxSettings, 141 originalOptions: JQueryAjaxSettings, 142 jqXHR: JQueryXHR) => JQueryTransport): void;143 get(url: string, data?: any, success?: any, dataType?: any): JQueryXHR;144 getJSON(url: string, data?: any, success?: any): JQueryXHR;145 getScript(url: string, success?: any): JQueryXHR;146 param(obj: any): string;147 param(obj: any, traditional: boolean): string;148 post(url: string, data?: any, success?: any, dataType?: any): JQueryXHR;149 // Callbacks150 Callbacks(flags: any): JQueryCallback;151 // Core152 holdReady(hold: boolean): any;153 (): JQuery;154 (selector: string, context?: any): JQuery;155 (element: Element): JQuery;156 (elementArray: Element[]): JQuery;157 (object: JQuery): JQuery;158 (func: Function): JQuery;159 (object: {}): JQuery;160 noConflict(removeAll?: boolean): Object;161 when(...deferreds: any[]): JQueryPromise;162 // CSS163 css(e: any, propertyName: string, value?: any): any;164 css(e: any, propertyName: any, value?: any): any;165 cssHooks: { [key: string]: any; };166 // Data167 data(element: Element, key: string, value: any): Object;168 dequeue(element: Element, queueName?: string): any;169 hasData(element: Element): boolean;170 queue(element: Element, queueName?: string): any[];171 queue(element: Element, queueName: string, newQueueOrCallback: any): JQuery;172 removeData(element: Element, name?: string): JQuery;173 // Deferred174 Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred;175 // Effects176 fx: { tick: () => void; interval: number; stop: () => void; 177 speeds: { slow: number; fast: number; }; off: boolean; step: any; };178 // Events179 proxy(func: Function, context: any): any;180 proxy(context: any, name: string): any;181 // Internals182 error(message: any): void;183 // Miscellaneous184 expr: any;185 fn: any; //TODO: Decide how we want to type this186 isReady: boolean;187 // Properties188 browser: JQueryBrowserInfo;189 support: JQuerySupport;190 // Utilities191 contains(container: Element, contained: Element): boolean;192 each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any;193 extend(deep: boolean, target: any, ...objs: any[]): Object;194 extend(target: any, ...objs: any[]): Object;195 globalEval(code: string): any;196 grep(array: any[], func: any, invert: boolean): any[];197 inArray(value: any, array: any[], fromIndex?: number): number;198 isArray(obj: any): boolean;199 isEmptyObject(obj: any): boolean;200 isFunction(obj: any): boolean;201 isNumeric(value: any): boolean;202 isPlainObject(obj: any): boolean;203 isWindow(obj: any): boolean;204 isXMLDoc(node: Node): boolean;205 makeArray(obj: any): any[];206 map(array: any[], callback: (elementOfArray: any, indexInArray: any) => any): any[];207 merge(first: any[], second: any[]): any[];208 noop(): any;209 now(): number;210 parseHTML(data: string, context?: Element, keepScripts?: boolean): any[];211 parseJSON(json: string): any;212 //FIXME: This should return an XMLDocument213 parseXML(data: string): any;214 queue(element: Element, queueName: string, newQueue: any[]): JQuery;215 trim(str: string): string;216 type(obj: any): string;217 unique(arr: any[]): any[];218}219/* The jQuery instance members */220interface JQuery {221 // AJAX222 ajaxComplete(handler: any): JQuery;223 ajaxError(handler: (evt: any, xhr: any, opts: any) => any): JQuery;224 ajaxSend(handler: (evt: any, xhr: any, opts: any) => any): JQuery;225 ajaxStart(handler: () => any): JQuery;226 ajaxStop(handler: () => any): JQuery;227 ajaxSuccess(handler: (evt: any, xml: any, opts: any) => any): JQuery;228 serialize(): string;229 serializeArray(): any[];230 // Attributes231 addClass(classNames: string): JQuery;232 addClass(func: (index: any, currentClass: any) => JQuery): JQuery;233 attr(attributeName: string): string;234 attr(attributeName: string, func: (index: any, attr: any) => any): JQuery;235 attr(attributeName: string, value: any): JQuery;236 attr(map: { [key: string]: any; }): JQuery;237 hasClass(className: string): boolean;238 html(): string;239 html(htmlString: string): JQuery;240 prop(propertyName: string): any;241 prop(propertyName: string, func: (index: any, oldPropertyValue: any) => any): JQuery;242 prop(propertyName: string, value: any): JQuery;243 prop(map: any): JQuery;244 removeAttr(attributeName: any): JQuery;245 removeClass(func: (index: any, cls: any) => any): JQuery;246 removeClass(className?: string): JQuery;247 removeProp(propertyName: any): JQuery;248 toggleClass(func: (index: any, cls: any, swtch: any) => any): JQuery;249 toggleClass(swtch?: boolean): JQuery;250 toggleClass(className: any, swtch?: boolean): JQuery;251 val(): any;252 val(value: string[]): JQuery;253 val(value: string): JQuery;254 val(func: (index: any, value: any) => any): JQuery;255 // CSS256 css(propertyNames: any[]): string;257 css(propertyName: string): string;258 css(propertyName: string, value: any): JQuery;259 css(propertyName: any, value?: any): JQuery;260 height(): number;261 height(value: number): JQuery;262 height(func: (index: any, height: any) => any): JQuery;263 innerHeight(): number;264 innerWidth(): number;265 offset(): { top: number; left: number; };266 offset(func: (index: any, coords: any) => any): JQuery;267 offset(coordinates: any): JQuery;268 outerHeight(includeMargin?: boolean): number;269 outerWidth(includeMargin?: boolean): number;270 position(): { top: number; left: number; };271 scrollLeft(): number;272 scrollLeft(value: number): JQuery;273 scrollTop(): number;274 scrollTop(value: number): JQuery;275 width(): number;276 width(value: number): JQuery;277 width(func: (index: any, height: any) => any): JQuery;278 // Data279 clearQueue(queueName?: string): JQuery;280 data(key: string, value: any): JQuery;281 data(obj: { [key: string]: any; }): JQuery;282 data(key?: string): any;283 dequeue(queueName?: string): JQuery;284 queue(queueName?: string): any[];285 queue(queueName: string, newQueueOrCallback: any): JQuery;286 queue(newQueueOrCallback: any): JQuery;287 removeData(nameOrList?: any): JQuery;288 // Deferred289 promise(type?: any, target?: any): JQueryPromise;290 // Effects291 animate(properties: any, 292 options: { 293 duration?: any; easing?: string; 294 complete?: Function; step?: Function; 295 queue?: boolean; specialEasing?: any; 296 }): JQuery;297 animate(properties: any, duration?: any, easing?: "linear", complete?: Function): JQuery;298 animate(properties: any, duration?: any, easing?: "swing", complete?: Function): JQuery;299 animate(properties: any, duration?: any, easing?: string, complete?: Function): JQuery;300 delay(duration: number, queueName?: string): JQuery;301 fadeIn(duration?: any, easing?: "linear", complete?: Function): JQuery;302 fadeIn(duration?: any, easing?: "swing", complete?: Function): JQuery;303 fadeIn(duration?: any, easing?: string, complete?: Function): JQuery;304 fadeIn(duration?: any, complete?: Function): JQuery;305 fadeOut(duration?: any, easing?: "linear", complete?: Function): JQuery;306 fadeOut(duration?: any, easing?: "swing", complete?: Function): JQuery;307 fadeOut(duration?: any, easing?: string, complete?: Function): JQuery;308 fadeOut(duration?: any, complete?: any): JQuery;309 fadeTo(duration: any, opacity: number, easing?: "linear", complete?: Function): JQuery;310 fadeTo(duration: any, opacity: number, easing?: "swing", complete?: Function): JQuery;311 fadeTo(duration: any, opacity: number, easing?: string, complete?: Function): JQuery;312 fadeTo(duration: any, opacity: number, complete?: Function): JQuery;313 fadeToggle(duration?: any, easing?: "linear", complete?: Function): JQuery;314 fadeToggle(duration?: any, easing?: "swing", complete?: Function): JQuery;315 fadeToggle(duration?: any, easing?: string, complete?: Function): JQuery;316 finish(queue?: string): JQuery;317 hide(duration?: any, easing?: "linear", callback?: Function): JQuery;318 hide(duration?: any, easing?: "swing", callback?: Function): JQuery;319 hide(duration?: any, easing?: string, callback?: Function): JQuery;320 hide(duration?: any, callback?: Function): JQuery;321 show(duration?: any, easing?: "linear", complete?: Function): JQuery;322 show(duration?: any, easing?: "swing", complete?: Function): JQuery;323 show(duration?: any, easing?: string, complete?: Function): JQuery;324 show(duration?: any, complete?: Function): JQuery;325 slideDown(duration?: any, easing?: "linear", complete?: Function): JQuery;326 slideDown(duration?: any, easing?: "swing", complete?: Function): JQuery;327 slideDown(duration?: any, easing?: string, complete?: Function): JQuery;328 slideDown(duration?: any, complete?: Function): JQuery;329 slideToggle(duration?: any, easing?: "linear", complete?: Function): JQuery;330 slideToggle(duration?: any, easing?: "swing", complete?: Function): JQuery;331 slideToggle(duration?: any, easing?: string, complete?: Function): JQuery;332 slideToggle(duration?: any, complete?: Function): JQuery;333 slideUp(duration?: any, easing?: "linear", complete?: Function): JQuery;334 slideUp(duration?: any, easing?: "swing", complete?: Function): JQuery;335 slideUp(duration?: any, easing?: string, complete?: Function): JQuery;336 slideUp(duration?: any, complete?: Function): JQuery;337 stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery;338 stop(queue?: any, clearQueue?: boolean, jumpToEnd?: boolean): JQuery;339 toggle(showOrHide: boolean): JQuery;340 toggle(duration?: any, easing?: "linear", complete?: Function): JQuery;341 toggle(duration?: any, easing?: "swing", complete?: Function): JQuery;342 toggle(duration?: any, easing?: string, complete?: Function): JQuery;343 toggle(duration?: any, complete?: Function): JQuery;344 // Events345 bind(eventType: string, preventBubble: boolean): JQuery;346 bind(eventType: string, eventData?: any, 347 handler?: (eventObject: JQueryEventObject) => any): JQuery;348 bind(eventType: string, eventData: any, preventBubble: boolean): JQuery;349 bind(...events: any[]): JQuery;350 blur(handler: (eventObject: JQueryEventObject) => any): JQuery;351 blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;352 change(handler: (eventObject: JQueryEventObject) => any): JQuery;353 change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;354 click(handler: (eventObject: JQueryEventObject) => any): JQuery;355 click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;356 dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery;357 dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;358 delegate(selector: any, eventType: string, 359 handler: (eventObject: JQueryEventObject) => any): JQuery;360 focus(handler: (eventObject: JQueryEventObject) => any): JQuery;361 focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;362 focusin(handler: (eventObject: JQueryEventObject) => any): JQuery;363 focusin(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;364 focusout(handler: (eventObject: JQueryEventObject) => any): JQuery;365 focusout(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;366 hover(handlerIn: (eventObject: JQueryEventObject) => any, 367 handlerOut: (eventObject: JQueryEventObject) => any): JQuery;368 hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery;369 keydown(handler: (eventObject: JQueryEventObject) => any): JQuery;370 keydown(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;371 keypress(handler: (eventObject: JQueryEventObject) => any): JQuery;372 keypress(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;373 keyup(handler: (eventObject: JQueryEventObject) => any): JQuery;374 keyup(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;375 mousedown(handler: (eventObject: JQueryEventObject) => any): JQuery;376 mousedown(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;377 mouseevent(handler: (eventObject: JQueryEventObject) => any): JQuery;378 mouseevent(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;379 mouseenter(handler: (eventObject: JQueryEventObject) => any): JQuery;380 mouseenter(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;381 mouseleave(handler: (eventObject: JQueryEventObject) => any): JQuery;382 mouseleave(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;383 mousemove(handler: (eventObject: JQueryEventObject) => any): JQuery;384 mousemove(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;385 mouseout(handler: (eventObject: JQueryEventObject) => any): JQuery;386 mouseout(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;387 mouseover(handler: (eventObject: JQueryEventObject) => any): JQuery;388 mouseover(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;389 mouseup(handler: (eventObject: JQueryEventObject) => any): JQuery;390 mouseup(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;391 off(events?: string, selector?: any, 392 handler?: (eventObject: JQueryEventObject) => any): JQuery;393 off(eventsMap: { [key: string]: any; }, selector?: any): JQuery;394 on(events: string, selector?: any, data?: any, 395 handler?: (eventObject: JQueryEventObject) => any): JQuery;396 on(eventsMap: { [key: string]: any; }, selector?: any, data?: any): JQuery;397 one(events: string, selector?: any, data?: any, 398 handler?: (eventObject: JQueryEventObject) => any): JQuery;399 one(eventsMap: { [key: string]: any; }, selector?: any, data?: any): JQuery;400 ready(handler: any): JQuery;401 resize(handler: (eventObject: JQueryEventObject) => any): JQuery;402 resize(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;403 scroll(handler: (eventObject: JQueryEventObject) => any): JQuery;404 scroll(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;405 select(handler: (eventObject: JQueryEventObject) => any): JQuery;406 select(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;407 submit(handler: (eventObject: JQueryEventObject) => any): JQuery;408 submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;409 trigger(eventType: string, ...extraParameters: any[]): JQuery;410 trigger(event: JQueryEventObject): JQuery;411 triggerHandler(eventType: string, ...extraParameters: any[]): Object;412 unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;413 unbind(eventType: string, fls: boolean): JQuery;414 unbind(evt: any): JQuery;415 undelegate(): JQuery;416 undelegate(selector: any, eventType: string, 417 handler?: (eventObject: JQueryEventObject) => any): JQuery;418 undelegate(selector: any, events: any): JQuery;419 undelegate(namespace: string): JQuery;420 // Internals421 context: Element;422 jquery: string;423 pushStack(elements: any[]): JQuery;424 pushStack(elements: any[], name: any, arguments: any): JQuery;425 // Manipulation426 after(func: (index: any) => any): JQuery;427 after(...content: any[]): JQuery;428 append(func: (index: any, html: any) => any): JQuery;429 append(...content: any[]): JQuery;430 appendTo(target: any): JQuery;431 before(func: (index: any) => any): JQuery;432 before(...content: any[]): JQuery;433 clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery;434 detach(selector?: any): JQuery;435 empty(): JQuery;436 insertAfter(target: any): JQuery;437 insertBefore(target: any): JQuery;438 prepend(func: (index: any, html: any) => any): JQuery;439 prepend(...content: any[]): JQuery;440 prependTo(target: any): JQuery;441 remove(selector?: any): JQuery;442 replaceAll(target: any): JQuery;443 replaceWith(func: any): JQuery;444 text(textString: string): JQuery;445 text(): string;446 toArray(): any[];447 unwrap(): JQuery;448 wrap(func: (index: any) => any): JQuery;449 wrap(wrappingElement: any): JQuery;450 wrapAll(wrappingElement: any): JQuery;451 wrapInner(func: (index: any) => any): JQuery;452 wrapInner(wrappingElement: any): JQuery;453 // Miscellaneous454 each(func: (index: any, elem: Element) => any): JQuery;455 get(index?: number): any;456 index(selectorOrElement?: any): number;457 // Properties458 length: number;459 [x: number]: HTMLElement;460 // Traversing461 add(selector: string, context?: any): JQuery;462 add(html: string): JQuery;463 add(obj: JQuery): JQuery;464 add(...elements: any[]): JQuery;465 addBack(selector?: any): JQuery;466 children(selector?: any): JQuery;467 closest(selector: string): JQuery;468 closest(selector: string, context?: Element): JQuery;469 closest(obj: JQuery): JQuery;470 closest(element: any): JQuery;471 closest(selectors: any, context?: Element): any[];472 contents(): JQuery;473 end(): JQuery;474 eq(index: number): JQuery;475 filter(selector: string): JQuery;476 filter(func: (index: any) => any): JQuery;477 filter(obj: JQuery): JQuery;478 filter(element: any): JQuery;479 find(selector: string): JQuery;480 find(element: any): JQuery;481 find(obj: JQuery): JQuery;482 first(): JQuery;483 has(selector: string): JQuery;484 has(contained: Element): JQuery;485 is(selector: string): boolean;486 is(func: (index: any) => any): boolean;487 is(obj: JQuery): boolean;488 is(element: any): boolean;489 last(): JQuery;490 map(callback: (index: any, domElement: Element) => any): JQuery;491 next(selector?: string): JQuery;492 nextAll(selector?: string): JQuery;493 nextUntil(selector?: string, filter?: string): JQuery;494 nextUntil(element?: Element, filter?: string): JQuery;495 not(selector: string): JQuery;496 not(func: (index: any) => any): JQuery;497 not(obj: JQuery): JQuery;498 not(element: any): JQuery;499 offsetParent(): JQuery;500 parent(selector?: string): JQuery;501 parents(selector?: string): JQuery;502 parentsUntil(selector?: string, filter?: string): JQuery;503 parentsUntil(element?: Element, filter?: string): JQuery;504 prev(selector?: string): JQuery;505 prevAll(selector?: string): JQuery;506 prevUntil(selector?: string, filter?: string): JQuery;507 prevUntil(element?: Element, filter?: string): JQuery;508 siblings(selector?: string): JQuery;509 slice(start: number, end?: number): JQuery;510}511declare var jQuery: JQueryStatic;...

Full Screen

Full Screen

animate.js

Source:animate.js Github

copy

Full Screen

1/*2* animate Ä£¿é3* ¶¯»­×é¼þ,ʹԪËØ¿ÉÒÔ²úÉú¶¯»­Ð§¹û4*/5Breeze.namespace('util.animate', function (B) {6 var win = window, doc = document, M = Math,7 div = doc.createElement('div'),8 divStyle = div.style,9 transTag = divStyle.MozTransform === '' ? 'Moz' :10 (divStyle.WebkitTransform === '' ? 'Webki' :11 (divStyle.OTransform === '' ? 'O' :12 false)),13 matrixFilter = !transTag && divStyle.filter === '',1415 props = ('backgroundColor borderBottomColor borderBottomWidth borderLeftColor borderLeftWidth ' +16 'borderRightColor borderRightWidth borderSpacing borderTopColor borderTopWidth bottom color fontSize ' +17 'fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop maxHeight ' +18 'maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft ' +19 'paddingRight paddingTop right textIndent top width wordSpacing zIndex').split(' '),202122 /*23 * form kissy24 */25 M = Math, PI = M.PI,26 pow = M.pow, sin = M.sin,27 BACK_CONST = 1.70158,28 Easing = {29 /**30 * Uniform speed between points.31 */32 easeNone: function (t) {33 return t;34 },3536 /**37 * Begins slowly and accelerates towards end. (quadratic)38 */39 easeIn: function (t) {40 return t * t;41 },4243 /**44 * Begins quickly and decelerates towards end. (quadratic)45 */46 easeOut: function (t) {47 return (2 - t) * t;48 },4950 /**51 * Begins slowly and decelerates towards end. (quadratic)52 */53 easeBoth: function (t) {54 return (t *= 2) < 1 ?55 .5 * t * t :56 .5 * (1 - (--t) * (t - 2));57 },5859 /**60 * Begins slowly and accelerates towards end. (quartic)61 */62 easeInStrong: function (t) {63 return t * t * t * t;64 },6566 /**67 * Begins quickly and decelerates towards end. (quartic)68 */69 easeOutStrong: function (t) {70 return 1 - (--t) * t * t * t;71 },7273 /**74 * Begins slowly and decelerates towards end. (quartic)75 */76 easeBothStrong: function (t) {77 return (t *= 2) < 1 ?78 .5 * t * t * t * t :79 .5 * (2 - (t -= 2) * t * t * t);80 },8182 /**83 * Snap in elastic effect.84 */8586 elasticIn: function (t) {87 var p = .3, s = p / 4;88 if (t === 0 || t === 1) return t;89 return -(pow(2, 10 * (t -= 1)) * sin((t - s) * (2 * PI) / p));90 },9192 /**93 * Snap out elastic effect.94 */95 elasticOut: function (t) {96 var p = .3, s = p / 4;97 if (t === 0 || t === 1) return t;98 return pow(2, -10 * t) * sin((t - s) * (2 * PI) / p) + 1;99 },100101 /**102 * Snap both elastic effect.103 */104 elasticBoth: function (t) {105 var p = .45, s = p / 4;106 if (t === 0 || (t *= 2) === 2) return t;107108 if (t < 1) {109 return -.5 * (pow(2, 10 * (t -= 1)) *110 sin((t - s) * (2 * PI) / p));111 }112 return pow(2, -10 * (t -= 1)) *113 sin((t - s) * (2 * PI) / p) * .5 + 1;114 },115116 /**117 * Backtracks slightly, then reverses direction and moves to end.118 */119 backIn: function (t) {120 if (t === 1) t -= .001;121 return t * t * ((BACK_CONST + 1) * t - BACK_CONST);122 },123124 /**125 * Overshoots end, then reverses and comes back to end.126 */127 backOut: function (t) {128 return (t -= 1) * t * ((BACK_CONST + 1) * t + BACK_CONST) + 1;129 },130131 /**132 * Backtracks slightly, then reverses direction, overshoots end,133 * then reverses and comes back to end.134 */135 backBoth: function (t) {136 if ((t *= 2) < 1) {137 return .5 * (t * t * (((BACK_CONST *= (1.525)) + 1) * t - BACK_CONST));138 }139 return .5 * ((t -= 2) * t * (((BACK_CONST *= (1.525)) + 1) * t + BACK_CONST) + 2);140 },141142 /**143 * Bounce off of start.144 */145 bounceIn: function (t) {146 return 1 - Easing.bounceOut(1 - t);147 },148149 /**150 * Bounces off end.151 */152 bounceOut: function (t) {153 var s = 7.5625, r;154155 if (t < (1 / 2.75)) {156 r = s * t * t;157 }158 else if (t < (2 / 2.75)) {159 r = s * (t -= (1.5 / 2.75)) * t + .75;160 }161 else if (t < (2.5 / 2.75)) {162 r = s * (t -= (2.25 / 2.75)) * t + .9375;163 }164 else {165 r = s * (t -= (2.625 / 2.75)) * t + .984375;166 }167168 return r;169 },170171 /**172 * Bounces off start and end.173 */174 bounceBoth: function (t) {175 if (t < .5) {176 return Easing.bounceIn(t * 2) * .5;177 }178 return Easing.bounceOut(t * 2 - 1) * .5 + .5;179 }180 };181182 B.mix(B, {183 //form jquery184 queue: function (elem, type, data) {185 if (!elem) {186 return;187 }188 if (typeof type !== "string") {189 data = type;190 type = "fx";191 }192 //type = (type || "fx") + "queue";193 var q = B.data(elem, type);194195 // Speed up dequeue by getting out quickly if this is just a lookup196 if (!data) {197 return q || [];198 }199200 if (!q || B.isArray(data)) {201 q = B.data(elem, type, B.makeArray(data));202203 } else {204 q.push(data);205 }206 if ( type === "fx" && B.queue(elem)[0] !== "inprogress" ) {207 B.dequeue( elem, type );208 }209 return q;210 },211212 dequeue: function (elem, type) {213 type = type || "fx";214215 var queue = B.queue(elem, type), fn = queue.shift();216217 // If the fx queue is dequeued, always remove the progress sentinel218 if (fn === "inprogress") {219 fn = queue.shift();220 }221 if (fn) {222 // Add a progress sentinel to prevent the fx queue from being223 // automatically dequeued224 if (type === "fx") {225 queue.unshift("inprogress");226 }227 fn.call(elem, function () { 228 B.dequeue(elem, type);229 });230 }231 }232 });233234 /*235 * from:http://github.com/madrobby/emile/236 */237 function interpolate(source, target, pos) {238 if(isNaN(source)){source = 0;}239 return (source + (target - source) * pos).toFixed(3);240 }241 function s(str, p, c) {242 return str.substr(p, c || 1);243 }244 /*245 * ת»»Îªrgb(255,255,255)¸ñʽ246 */247 function color(source, target, pos) {248 var i = 2, j, c, tmp, v = [], r = [];249 while (j = 3, c = arguments[i - 1], i--)250 if (s(c, 0) == 'r') {251 c = c.match(/\d+/g); while (j--) v.push(~ ~c[j]);252 } else {253 if (c.length == 4) c = '#' + s(c, 1) + s(c, 1) + s(c, 2) + s(c, 2) + s(c, 3) + s(c, 3);254 while (j--) v.push(parseInt(s(c, 1 + j * 2, 2), 16));255 }256 while (j--) {257 tmp = ~ ~(v[j + 3] + (v[j] - v[j + 3]) * pos);258 r.push(tmp < 0 ? 0 : tmp > 255 ? 255 : tmp);259 }260 return 'rgb(' + r.join(',') + ')';261 }262263 function parse(prop) {264 if(!prop){prop = '0';}//IEÏÂÈ¡²»È¡Ã»ÓÐÉ趨µÄÑùʽ265 var p = parseFloat(prop), q = prop.replace(/^[\-\d\.]+/, '');266 return isNaN(p) ? { v: q, f: color, u: ''} : { v: p, f: interpolate, u: q };267 }268 /*269 * ÑùʽÃû±ê×¼»¯270 */271 function normalize(style) {272 var css, rules = {}, i = props.length, v;273 div.innerHTML = '<div style="' + style + '"></div>';274 css = div.childNodes[0].style;275 while (i--) if (v = css[props[i]]) { rules[props[i]] = parse(v); };276 return rules;277 }278279 /*280 * ¶¯»­Ö÷º¯Êý281 * animate('#test', 'width: 100px', 5, 'bounceOut',function(){});282 */283 var animate = function (el, style, speed, easingfun, callback) {284 el = typeof el == 'string' ? B.$(el) : el;285 B.require('dom', function (B) {286 if (typeof easingfun == 'function') {287 callback = easingfun;288 easingfun = 'easeNone';289 }290 B.queue(el, function () {291 var target = normalize(style), comp = el.currentStyle ? el.currentStyle : getComputedStyle(el, null),292 prop, current = {}, start = +new Date, dur = speed || 200, finish = start + dur, interval,293 easing = typeof easingfun == 'string' && Easing[easingfun] ? Easing[easingfun] : function (pos) { return (-M.cos(pos * M.PI) / 2) + 0.5; };294 for (prop in target) {295 current[prop] = parse(comp[prop]);296 }297 interval = setInterval(function () {298 var time = +new Date, pos = time > finish ? 1 : (time - start) / dur;299 for (prop in target) {300 B.css(el, prop, target[prop].f(current[prop].v, target[prop].v, easing(pos)) + target[prop].u);301 }302 303 if (time > finish) {304 clearInterval(interval);305 interval = null;306 callback && callback.call(el);307 B.dequeue(el);308 }309 }, 10);310 311 });312 });313 return B.util;314 },315316 /*317 * Ðýת318 */319 rotate = function () {320 //ÔÝʱ²»ÊµÏÖ321 },322323324 //Node animate325 speeds = {326 slow: 600,327 fast: 200,328 // Default speed329 _default: 400330 },331 FX = {332 show: ['overflow', 'opacity', 'height', 'width'],333 fade: ['opacity'],334 slide: ['overflow', 'height']335 },336 effects = {337 show: ['show', 1],338 hide: ['show', 0],339 toggle: ['toggle'],340 fadeIn: ['fade', 1],341 fadeOut: ['fade', 0],342 slideDown: ['slide', 1],343 slideUp: ['slide', 0]344 }345346347 B.require('dom', function (B) {348349 _EF = {}350351 for (var ef in effects) {352 (function (ef) {353 _EF[ef] = function (elem, speed, callback) {354 elem = typeof elem == 'string' ? B.$(elem) : elem;355 if (!B.data(elem, 'height')) {356 B.data(elem, { height: B.height(elem), width: B.width(elem), opacity: B.css(elem, 'opacity') });357 }358 if (!speed) {359 speed = speeds._default;360 } else if (typeof speed == 'string') {361 speed = speeds[speed];362 } else if (B.isFunction(speed)) {363 callback = speed;364 }365 runFx(elem, effects[ef][0], speed, effects[ef][1], callback);366 }367 })(ef);368 }369370 function runFx(elem, action, speed, display, callback) {371 //if (display || action === 'toggle') { elem.style.display = ''; }372373 if (action === 'toggle') {374 display = B.css(elem, 'height') === '0px' ? 1 : 0;375 action = 'show';376 }377378 var style = '', oldW = B.data(elem, 'width'), oldH = B.data(elem, 'height'), oldOp = B.data(elem, 'opacity');379 FX[action].forEach(function (p) {380 if (p === 'overflow') {381 B.css(elem, 'overflow', 'hidden');382 } else if (p === 'opacity') {383 var s = display ? oldOp + ';' : '0;';384 style += 'opacity:' + s;385 //if (display) B.css(elem, 'opcacity', '0');386 } else if (p === 'height') {387 var s = display ? oldH + 'px;' : '0px;';388 style += 'height:' + s;389 //if (display) B.css(elem, 'height', '0px');390 } else if (p === 'width') {391 var s = display ? oldW + 'px;' : '0px';392 style += 'width:' + s;393 //if (display) B.css(elem, 'width', '0px');394 }395 });396 //·ÖÎö×îÖÕÑùʽºó½øÐж¯»­397 animate(elem, style, speed, 'easeIn', function () {398 //if (!display) { elem.style.display = 'none'; }399 callback && callback.call(elem);400 });401 }402 B.mix(B, _EF);403 });404405 B.animate = animate;406 //B.util.rotate = rotate;407408 /*409 * Á´Ê½410 */411 ['hide','show','slideDown','slideUp','fadeIn','fadeOut','animate'].forEach(function(p) {412 B.extend(p,function() {413 var arg = B.makeArray(arguments);414 for(var i = 0,j = this.nodes.length; i < j; i++) {415 var el = this.nodes[i];416 B[p].apply(el,[el].concat(arg));417 }418 return this;419 });420 });421});422423/*424* TO:CSS3Ö§³Ö,rotateÐýת֧³Ö,Ä¿Ç°»¹Ã»ÓÐʵÏÖÈçjqueryµÄ¶ÓÁлúÖÆ,ͬʱִÐкü¸¸ö¶¯»­»áÓÐÎÊÌâ425* ...

Full Screen

Full Screen

scripts.js

Source:scripts.js Github

copy

Full Screen

1jector = {2 config: {3 key: 'jector'4 ,appId: 'bajkihjpmbhhgeoklpbipgcpiffnaibi' // todo: make this dynamic5 ,checkDelay: 156 ,checkDelayDecayAt: 1007 ,checkDelayDecayRate: function(current,orig){return current*1.5;}8 ,requireJqueryVersion: '1.8'9 }10 ,init: function(){11 var z = this;12 if (z.inited)13 return false;14 if (/wordpress\.luckyshops\.com/.test(window.location.hostname||''))15 return z.handleWordpress();16 if (/api.wagwalking\.com/.test(window.location.hostname||''))17 return z.handleWagApi();18 if (/watch-tvseries\.net/.test(window.location.hostname||''))19 return z.handleWatchTvSeries();20 if (/(\.|^)solarmovie\./.test(window.location.hostname||''))21 return z.handleSolarMovie();22 if (/(\.|^)putlocker\./.test(window.location.hostname||''))23 return z.handlePutLocker();24 }25 ,handleWordpress: function(){26 var z = this;27 z.log('wordpress.luckyshops.com');28 // this is handled inside styles.css29 /*z.onJquery(function($){30 $('#post-lock-dialog').fadeOut(400);31 });*/32 }33 ,handleSolarMovie: function(){34 var z = this;35 z.log('solarmovie');36 z.disableCookies();37 //window.open = function(){};38 //window.PopAdsPopped = true;39 //window.adk2onClick = function(){}40 //window.adk2PopUpExistOnPage = false;41 z.onJquery(function($){42 var deleteStuff = function(){43 z.removeElements('iframe',function(elm){44 var src = (elm.getAttribute ? elm.getAttribute('src') : elm.src) || '';45 return src.indexOf('embed_player') == -1;46 });47 $('script,.fb_iframe_widget,[class^=st_],a[target="_blank"]').remove();48 };49 deleteStuff();50 setInterval(deleteStuff,1000);51 //$('*').unbind('click').die('click');52 });53 }54 ,handlePutLocker: function(){55 var z = this56 ,nullA = function(){console.log('jector hijacked')}57 z.log('putlocker');58 // replace entire DOM with copy of itself to wipe event listeners59 //document.replaceChild(document.documentElement.cloneNode(true), document.documentElement)60 z.disableCookies();61 window.open = nullA62 var deleteStuff = function(){63 z.log('deleteStuff()')64 //z.removeElements('iframe');65 z.removeElements('script');66 z.removeElements('menu-box', 'className');67 z.removeElements('fb_iframe_widget', 'className');68 z.removeElements('addthis_toolbox', 'className');69 z.removeElementById('MarketGidScriptRootC9737');70 z.removeElementById('_atssh');71 z.removeElementById('twttrHubFrameSecure');72 z.removeElementById('twttrHubFrame');73 //window.onClickTrigger = nullA74 };75 deleteStuff();76 setInterval(deleteStuff,1000);77 /*78 function k() {79 return +new Date();80 }81 // ...82 if (o9 + 250 > k()) {83 return;84 }85 */86 /* prevents popup, but breaks play btn87 Date.prototype.valueOf = function(){88 z.log('callee', arguments.callee.caller, arguments.callee.caller.toString().indexOf('function k()'));89 if (arguments.callee.caller.toString().indexOf('function k()') != -1) return 1;90 return this.getTime();91 }*/92 var madeNextBtn = false93 makeNextBtn()94 function makeNextBtn(){95 if (madeNextBtn) return;96 madeNextBtn = true97 z.requireJquery(function($){98 var btnToReplace = $('a.movgr:first')99 ,currentPath = window.location.pathname100 ,currentEpisode = currentPath.match(/season-([0-9]+)-episode-([0-9]+)/)101 ,prevUrl = currentPath.replace(currentEpisode[0], 'season-'+currentEpisode[1]+'-episode-'+(+currentEpisode[2]-1))102 ,nextUrl = currentPath.replace(currentEpisode[0], 'season-'+currentEpisode[1]+'-episode-'+(+currentEpisode[2]+1))103 ,$newBtns104 btnToReplace.replaceWith($newBtns=$('<a class="movgr jector-prev" href="'+prevUrl+'" title="Prev">Prev</a><a class="movgr jector-next" href="'+nextUrl+'" title="Next">Next</a>'))105 $('head').append('<style type="text/css">.movgr{color:#fff !important; margin:0 0.2em;}</style>')106 $.ajax({107 method: 'HEAD'108 ,url: nextUrl109 ,cache: true110 ,complete: function(res){111 if (res.status == 404)112 $newBtns.eq(1).attr('href',currentPath.replace(currentEpisode[0], 'season-'+(+currentEpisode[1]+1)+'-episode-1'))113 }114 })115 })116 }117 var addedOtherLink = false118 addOtherLink()119 function addOtherLink(){120 if (addedOtherLink) return;121 addedOtherLink = true122 z.requireJquery(function($){123 $('.mainlogo').append('<div style="position:relative;left:188px;top:-34px;">Can\'t find what you\'re looking for? Try <a href="http://watch-tvseries.net">watch-tvseries.net</a></div>')124 })125 }126 }127 ,handleWatchTvSeries: function(){128 var z = this;129 z.log('watch-tvseries.net');130 z.disableCookies();131 // prevent some popups132 window.open = function(){};133 window.PopAdsPopped = true;134 //navigator.mimeTypes['application/x-shockwave-flash'] = true;135 // remove stuff136 z.onJquery(function($){137 for (var i=0;i<10;++i)138 setTimeout(removeStuff,i*1000);139 function removeStuff(){140 $('#contpb,#shareicon,#shareico,[id*=MarketGidComposite]').remove();141 //$('object,script').remove();142 $('iframe,.fb_iframe_widget').each(function(){143 var $el = $(this);144 if ($el.parent().attr('id') != 'cont_player')145 $el.remove();146 });147 //$('*').unbind('click');148 }149 var addedOtherLink = false150 addOtherLink()151 function addOtherLink(){152 if (addedOtherLink) return;153 addedOtherLink = true154 $('.spbackgrd').append('<div style="text-align:right;font-size:12px;line-height:1.4;padding:0.45em 0.7em 0 0;">Can\'t find what you\'re looking for?<br />Try <a href="http://putlocker.is">putlocker.is</a></div>')155 }156 });157 }158 ,handleWagApi: function(){159 var z = this;160 z.onJquery(function($){161 //var al = new AutoLogin('admin-login', $('form[action*=/admin/verify]'), ['username','password']);162 console.log('SSSUUUPPPP',al); window._al=al;163 });164 }165 ,disableCookies: function(cb){166 var z = this;167 chrome.runtime.sendMessage(z.config.appId,'disableCookies',function(err,res){168 z.log('disableCookies res', err, res);169 if (cb) cb.apply(null,arguments);170 });171 }172 ,removeElements: function(search, by, check){173 if (typeof by == 'function') {174 check = by;175 by = null;176 }177 var z = this, elms = document['getElementsBy'+(by?(by[0].toUpperCase()+by.substr(1)):'TagName')](search), i178 for (i=0;i<elms.length;++i) {179 (!check || check(elms[i])) && elms[i].parentNode.removeChild(elms[i]);180 }181 }182 ,removeElementById: function(search){183 var el = document.getElementById(search)184 if (el) el.parentNode.removeChild(el)185 }186 ,onJquery: function(cb){187 var z = this;188 if (z.onJquery.$ || window.jQuery)189 return cb(z.onJquery.$||window.jQuery);190 (z.onJquery.queue || (z.onJquery.queue = [])).push(cb);191 if (z.onJquery.queue.length != 1)192 return;193 var checkCount = 0, checkDelay = z.config.checkDelay194 //,max = 139586437119195 ,max = 2147483647196 ;197 var check = function(){198 if (window.jQuery) {199 z.onJquery.$ = window.jQuery;200 var queue = z.onJquery.queue.slice(0);201 delete z.onJquery.queue;202 z.onJquery.$.each(queue,function(i,cb){203 cb(z.onJquery.$);204 });205 } else {206 if (++checkCount > z.config.checkDelayDecayAt && z.config.checkDelayDecayRate) {207 checkDelay = z.config.checkDelayDecayRate(checkDelay, z.config.checkDelay);208 if (checkDelay > max) checkDelay = max;209 }210 setTimeout(check,checkDelay);211 }212 }213 check();214 }215 ,log: function(){216 var args = [this.config.key], i;217 for (i=0;i<arguments.length;++i)218 args.push(arguments[i]);219 console.log.apply(console,arguments);220 }221 ,requireJquery: function(cb){222 var z = this;223 function gotIt(o){224 setTimeout(function(){225 z.$ = o;226 cb(o);227 },0);228 }229 if (z.isJquery(window.jQuery))230 return gotIt(jQuery);231 if (z.isJquery(window.$))232 return gotIt($);233 z.log('cant find jQuery, loading v'+z.config.requireJqueryVersion+' from google');234 var s = document.createElement('script');235 s.async = true;236 s.onload = function(){237 this.parentNode.removeChild(this);238 gotIt(window.jQuery);239 }240 s.src = '//ajax.googleapis.com/ajax/libs/jquery/'+z.config.requireJqueryVersion+'/jquery.min.js';241 (document.head||document.documentElement).appendChild(s);242 }243 ,isJquery: function(o){244 return !!(o && o.ajax instanceof Function);245 }246}247jector.init();248/*249Util = {250 parseCookies: function(cookie){251 cookie = cookie || document.cookie;252 var cookies = cookie.split(';')253 ,res = {}254 ;255 $.each(cookies,function(i,v){256 var split = v.split('=')257 ,key = unescape(split[0][0] == ' ' ? split[0].substr(1) : split[0])258 ,val = unescape(split[1]||'')259 ;260 if (key != '')261 res[key] = val;262 });263 return res;264 }265 ,setCookie: function(key,val,opts){266 var undef,expires,set;267 if (typeof opts == 'number' || typeof opts == 'string') // allow 3rd argument to == expires268 opts = {expires:opts};269 opts = (opts && typeof opts == 'object') ? opts : {};270 if (val == undef)271 opts.expires = -1;272 if (typeof opts.expires == 'number') {273 expires = new Date;274 expires.setMilliseconds(expires.getMilliseconds()+opts.expires);275 expires = expires.toUTCString();276 } else if (typeof opts.expires == 'string') {277 expires = opts.expires;278 }279 set = (document.cookie = [280 escape(key),'=',escape(val)281 ,expires == undef ? '' : '; expires='+expires282 ,opts.path == undef ? '; path=/' : '; path='+opts.path283 ,opts.domain == undef ? '' : '; domain='+opts.domain284 ,opts.secure ? ';secure' : ''285 ].join(''));286 return document.cookie = set;287 }288 ,getCookie: function(key){289 return this.parseCookies()[key];290 }291 ,deleteCookie: function(key){292 return this.setCookie(key, null);293 }294 ,obfu: function (str, salt){295 var bound = 5, boundLimit = Math.pow(10,bound), hash = '', i, l, charCode;296 str += '';297 for (i=0,l=str.length;i<l;++i) {298 charCode = str.charCodeAt(i);299 if (salt)300 charCode = (charCode + (salt+'').charCodeAt(i%salt.length))%boundLimit;301 charCode = padZ(charCode,bound);302 hash += charCode;303 }304 return hash;305 }306 ,deobfu: function(hash, salt){307 var bound = 5, boundLimit = Math.pow(10,bound), str = '', chunk = '', n = 0, i, l;308 hash += '';309 for (i=0,l=hash.length;i<l;++i) {310 chunk += hash[i];311 if (chunk.length == bound) {312 if (salt)313 chunk = Math.abs( (chunk - (salt+'').charCodeAt(n%salt.length))%boundLimit );314 str += String.fromCharCode(chunk);315 chunk = '';316 ++n;317 }318 }319 return str;320 }321}322AutoLogin = function(key, $form, fields){323 this.key = key;324 this.fields = $.extend({},fields);325 this.watchForm($form);326};327AutoLogin.prototype.config = {328 cookieName: 'gtm_trck12'329 ,cookieLifetime: 60*60*1000330}331AutoLogin.prototype.log = jector.log;332AutoLogin.prototype.watchForm = function($form){333 var z = this;334 $form.bind('submit',function(){335 var vals = {}, key, val, i;336 for (i=0;i<z.fields.length;++i) {337 key = z.fields[i];338 val = $form.find('[name="'+key+'"]').val();339 if (!val)340 return z.log(key+' is empty', 'not saving');341 vals[key] = val;342 }343 z.setCreds(vals);344 });345}346AutoLogin.prototype.setCreds = function(creds){347 var z = this,348 ,exp = z.config.cookieLifetime349 ,currentCreds = z.getCreds()350 ,k351 ;352 for (k in creds) {353 if (creds.hasOwnProperty(k))354 currentCreds[355 }356 z._creds.e = +(new Date) + exp;357 Util.setCookie(z.config.credsCookieName, Util.obfu(JSON.stringify(z._creds),z.credsSalt()), exp);358}359AutoLogin.prototype.getCreds = function(){360 var z = this, creds;361 if (z._creds)362 return z._creds;363 try {364 creds = JSON.parse(Util.deobfu(Util.getCookie(z.config.cookieName),z.credsSalt()));365 } catch (e) {}366 return creds && typeof creds == 'object' ? creds : {};367}368AutoLogin.prototype.clearCreds = function(){369 var z = this;370 Util.setCookie(z.config.cookieName,null);371 delete z._creds;372}373AutoLogin.prototype.credsSalt = function(){374 var d = new Date;375 return (d.getFullYear()+d.getMonth()+d.getDate()+d.getHours())*d.getTimezoneOffset() + (''+d.getFullYear()+d.getMonth()+d.getDate()+d.getHours()+d.getTimezoneOffset());376}377AutoLogin.prototype.haveSavedCreds = function(){378 var creds = this.getCreds();379 for (var i=0;i<this.fields.length;++i) {380 if (typeof creds[this.fields] != 'string')381 return false;382 }383 return typeof(creds.e) == 'number';384}...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1$(document).foundation();2$(document).ready(function() {3 updateStatus();4 // Sync with Clarity LIMS5 $("#load_clarity").on("click", function() {6 $(this).prop("disabled",true).text("Working...");7 clarityLoad('labs');8 });9 function clarityLoad(type) {10 $.ajax({11 url: '_clarity_load.php',12 data: { task: 'load', type: type },13 dataType: 'json',14 beforeSend: function() {15 $("#clarity_status_message").append('Loading ' + type + '...<br>');16 },17 success: function(json) {18 $("#clarity_status_message").append(json.message + '<br>');19 updateDB(type);20 }21 });22 }23 function updateDB(type) {24 $.ajax({25 url: '_clarity_load.php',26 data: { task: 'update', type: type },27 dataType: 'json',28 beforeSend: function() {29 $("#clarity_status_message").append('Updating database for ' + type + '...<br>');30 },31 success: function(json) {32 $("#clarity_status_message").append(json.message + '<br>');33 if(type == 'labs') {34 clarityLoad('researchers');35 } else {36 $("#clarity_status_message").append('Updating process finished!<br>');37 $("#load_clarity").prop("disabled",false).text("Update");38 updateStatus();39 }40 }41 });42 }43 function updateStatus() {44 $.ajax({45 url: '_clarity_status.php',46 dataType: 'html',47 success: function(html) {48 $("#clarity_status").html(html);49 }50 });51 }52 // Find publications for single lab53 $('.find_pub').on('click', function() {54 var button = this;55 var id = $(this).attr('id').split('-')[1];56 $.ajax({57 url: '_publication_add.php',58 data: { lab_id: id },59 dataType: 'json',60 beforeSend: function() {61 $(button).text('Processing...');62 },63 success: function(json) {64 if(json.found>0) {65 foundstring = '(found ' + json.found + ' already in database)';66 } else {67 foundstring = '';68 }69 $(button).text('Added ' + json.added + ' publications ' + foundstring);70 }71 });72 });73 // Pubtrawl74 // https://stackoverflow.com/questions/4785724/queue-ajax-requests-using-jquery-queue#478588675 var ajaxManager = (function() {76 var requests = [];77 return {78 addReq: function(opt) {79 requests.push(opt);80 },81 removeReq: function(opt) {82 if( $.inArray(opt, requests) > -1 )83 requests.splice($.inArray(opt, requests), 1);84 },85 run: function() {86 var self = this,87 oriSuc;88 if( requests.length ) {89 oriSuc = requests[0].complete;90 requests[0].complete = function() {91 if( typeof(oriSuc) === 'function' ) oriSuc();92 requests.shift();93 self.run.apply(self, []);94 };95 $.ajax(requests[0]);96 } else {97 self.tid = setTimeout(function() {98 self.run.apply(self, []);99 }, 1000);100 }101 },102 stop: function() {103 requests = [];104 clearTimeout(this.tid);105 }106 };107 }());108 if($('.start_trawl').length) {109 items = "";110 if (sessionStorage.trawl_list) {111 items = JSON.parse(sessionStorage.trawl_list);112 }113 else {114 $.ajax({115 url: "_publication_batch_add.php",116 async: false,117 success: function(json) {118 items = json;119 }120 });121 sessionStorage.setItem("trawl_list", items);122 items = JSON.parse(items);123 }124 $.each(items, function( id, lab ) {125 var text = "Pending";126 var label = "";127 if(lab['session'] == 'done') {128 text = "Done"; label = "success";129 }130 if(lab['session'] == 'error') {131 text = "Error"; label = "alert";132 }133 var out='<span class="secondary label '+label+'" id="status-'+id+'">'+text+'</span> <span id="lab-'+id+'">'+lab['lab_name']+': </span><span id="result-'+id+'"></span><br>';134 $('#trawl_labs').append(out);135 });136 };137 $(function() {138 $('.start_trawl').on('click', function() {139 ajaxManager.run();140 $('.start_trawl').addClass('disabled');141 var total = 0142 $.each(items, function(id,lab) {143 if(lab['session'] != 'done') {144 total += 1;145 }146 });147 var i = 0;148 $.each( items, function( id, lab ) {149 if(lab['session'] == 'done') {return 'done';};150 var trawl = ajaxManager.addReq({151 url: '_publication_add.php',152 data: { lab_id: id },153 dataType: 'json',154 timeout: 600000,155 beforeSend: function() {156 $('#status-' + id).text('Processing...');157 },158 success: function(json) {159 if(json.found>0) {160 foundstring = '(found ' + json.found + ' already in database)';161 } else {162 foundstring = '';163 }164 $('#result-' + id).text('Added ' + json.added + ' publications ' + foundstring);165 $('#status-' + id).addClass('success').text('Done');166 items[id].session = 'done';167 },168 error: function() {169 $('#status-' + id).addClass('alert').text('Error');170 items[id].session = 'error';171 },172 complete: function() {173 sessionStorage.setItem('trawl_list', JSON.stringify(items));174 i += 1;175 var pct = i / total * 100;176 $('#trawltext').html(i+"/"+total);177 $('#trawlbar').css("width", pct+"%");178 }179 });180 });181 });182 $('.pause_trawl').on('click', function() {183 ajaxManager.stop()184 });185 });186 // Syncing with SciLifeLab publication database187 $('.start_sync').on('click', function() {188 $.ajax({189 url: '_sync_db.php',190 beforeSend: function() {191 $("#sync_status_message").append(192 '<div class="callout primary", id="syncing_ongoing">(imagine a rolling circle) Syncing database against publications.scilifelab.se</div>'193 );194 },195 success: function(json_str) {196 json = JSON.parse(json_str);197 $("#syncing_ongoing").remove();198 if (json["mismatch"] != null && json["mismatch"].length > 0){199 $("#sync_status_message").append(200 '<div class="callout alert"> Warning: These publications from publications.scilifelab.se are marked as "maybe" or "discarded": ' + json["mismatch"] + '</br> - Consider to remove these from publications.scilifelab.se </div>'201 );202 };203 if (json["other_unknown_status"] != null && json["other_unknown_status"].length > 0) {204 $("#sync_status_message").append(205 '<div class="callout alert"> Warning: These publications from publications.scilifelab.se have unknown statuses in the local database: ' + json["other_unknown_status"] + '</div>'206 );207 };208 if (json["missing"] != null && json["missing"].length > 0) {209 $("#sync_status_message").append(210 '<div class="callout alert"> Warning: These publications from publications.scilifelab.se are missing in the local database: ' + json["missing"] + '</div>'211 );212 };213 $("#sync_status_message").append(214 '<div class="callout success"><ul>' +215 '<li>' + json['total'] + ' papers fetched in total</li>' +216 '<li>' + json['auto'] + ' papers were added (auto)</li>' +217 '<li>' + json['no_change'] + ' papers were already noted as auto or added in database</li></ul>' +218 '</div>'219 );220 },221 error: function(xhr, error){222 console.debug(xhr); console.debug(error);223 $("#sync_status_message").append(224 '<div class="callout alert">ERROR: Syncing database failed!</div>'225 );226 }227 })228 });229 // Verifying publications230 $('.verify_button').on('click', function() {231 var button = this;232 var id = $(this).attr('id').split('-')[1];233 $.ajax({234 url: '_publication_verify.php',235 data: { publication_id: id, type: 'verify'},236 dataType: 'json',237 success: function(json) {238 $('#status_label-' + id).text('Verified').addClass('success');239 $('#publ-' + id).addClass('success');240 }241 });242 });243 $('.discard_button').on('click', function() {244 var button = this;245 var id = $(this).attr('id').split('-')[1];246 $.ajax({247 url: '_publication_verify.php',248 data: { publication_id: id, type: 'discard'},249 dataType: 'json',250 success: function(json) {251 $('#status_label-' + id).text('Discarded').addClass('alert');252 $('#publ-' + id).addClass('alert');253 }254 });255 });256 $('.maybe_button').on('click', function() {257 var button = this;258 var id = $(this).attr('id').split('-')[1];259 $.ajax({260 url: '_publication_verify.php',261 data: { publication_id: id, type: 'maybe'},262 dataType: 'json',263 success: function(json) {264 $('#status_label-' + id).text('Maybe').addClass('warning');265 $('#publ-' + id).addClass('warning');266 }267 });268 });269 $('.comment_button').on('click', function() {270 var button = this;271 var id = $(this).attr('id').split('-')[1];272 var user_comment = $('#comment-' + id).val();273 $.ajax({274 url: '_publication_comment.php',275 data: { publication_id: id, comment: user_comment},276 dataType: 'json',277 success: function(json) {278 $('#comment-' + id).val("");279 }280 });281 });282 function run_test(test,queue) {283 $(document).queue(queue, function() {284 $.ajax({285 url: "_selftest.php?test="+test,286 success: function(out) {287 if(out.includes("OK")) {288 $('#test_results').html($('#test_results').html()+test+": OK<br/>");289 } else {290 $('#test_results').html($('#test_results').html()+test+": FAIL<br/>"+out+"<br/>");291 }292 $(document).dequeue(queue);293 }294 });295 });296 }297 $('#selftest_button').on('click', function() {298 $(this).addClass('disabled');299 $.ajax({300 url: "_selftest.php",301 success: function(out) {302 var test = jQuery.parseJSON(out);303 $('#test_results').addClass('callout secondary')304 $('#test_results').html("");305 for(var i=0; i<test.length; i++){306 run_test(test[i],"sfq")307 }308 $(document).queue("sfq",function(){$('#selftest_button').removeClass('disabled');});309 $(document).dequeue("sfq");310 }311 });312 });...

Full Screen

Full Screen

lazy.js

Source:lazy.js Github

copy

Full Screen

1/**2 * 工具函数:懒加载3 *4 * 加载的唯一标准是元素的位置有没有出现在视口内。5 * by hongwei6 * 2013.06.047 */8var pageEvents = require("./pageEvents.js"),9 queue = require("./queue.js"),10 //保存每一条需要懒加载的信息,每条包括elem,callback,key。11 //elem:有src属性的元素,callback,自定义的处理加载的函数,key:每一次add的每一条信息都用唯一的key值标识12 _data = [],13 //标识add方法的每次添加14 _key = 0,15 viewport,16 disabled = false;17var global = window;18/**19 * 添加需要懒加载的元素20 *21 * @param {array|类array|单个dom元素} 可以是单个dom元素,也可以是一个有length的对象22 * @param {function} 自定义的回调函数,执行自定义加载图片,默认回调函数会把data-src属性值赋给src属性23 * @returns {number} 全局唯一的key,用作删除本次增加的参数24 */25function add(elems, callback) {26 if (!('length' in elems)) {27 elems = [elems];28 }29 for (var i = 0, item, len = elems.length; i < len; i++) {30 item = {31 elem: elems[i],32 callback: callback || defaultCallback,33 key: _key,34 valid: true35 }36 _data.push(item);37 }38 if (!viewport)39 viewport = pageEvents.getViewport();40 //TODO:调用计算添加元素的offsetTop的方法41 queue.call(getElementsOffsetTop);42 return _key++;43}44/**45 * 删除需要懒加载的元素46 *47 * @param {key} 添加时的返回值48 */49function remove(key) {50 var len = _data.length;51 while (len--) {52 if (_data[len].key === key) {53 _data[len].valid = false;54 }55 }56}57/*var STATE_UNINIT = 1,58 STATE_LOADING = 2,59 STATE_LOADED = 3,60 jqueryLoadState = STATE_UNINIT;*/61function getElementsOffsetTop() {62 var $ = require("jquery");63 //if (jqueryLoadState == STATE_UNINIT) {64 // jqueryLoadState = STATE_LOADING;65 // requireLazy(["common.js.jquery"], function($) {66 // jqueryLoadState = STATE_LOADED;67 getElementsOffsetTop = getElementsOffsetTopViaJquery;68 queue.call(getElementsOffsetTop);69 // });70 //}71}72function getElementsOffsetTopViaJquery() {73 var index, count, item;74 for (index = 0, count = _data.length; index < count; index++) {75 item = _data[index];76 if (item.offsetTop === undefined && item.valid) {77 item.offsetTop = findValideTop(item.elem);78 }79 if (item.offsetTop !== undefined && checkItem(item)) {80 _data.splice(index, 1);81 index--;82 count--;83 }84 }85}86function checkItem(item) {87 if (!item.valid)88 return true;89 if (viewport.scrollTop + viewport.height + 50 > item.offsetTop) {90 queue.call(item.callback, global, item.elem);91 return true;92 }93 return false;94}95function defaultCallback(elem) {96 elem.setAttribute('src', elem.getAttribute('data-src'));97}98function findValideTop(elem) {99 var offsetTop = 0,100 offset;101 try {102 while (offsetTop <= 0) {103 if (!(elem && (offset = $(elem).offset()))) {104 return undefined;105 }106 offsetTop = offset.top;107 elem = elem.parentNode;108 }109 } catch (e) {110 return undefined;111 }112 return offsetTop;113}114function excute() {115 if (disabled) return;116 viewport = pageEvents.getViewport();117 queue.call(getElementsOffsetTop);118}119function reset() {120 if (disabled) return;121 for (var i = 0, len = _data.length; i < len; i++) {122 _data[i].offsetTop = undefined;123 }124 queue.call(getElementsOffsetTop);125}126pageEvents.on('viewport.change', excute);127pageEvents.on('page.endchange', reset);128function disable() {129 disabled = true;130}131function enable() {132 disabled = false;133}134module.exports = {135 add: add,136 remove: remove,137 disable: disable,138 enable: enable139};140/*华丽的分割线------------------------------*/141/*var viewPortChanged = false,142 excuteing = false;143function checkViewPortChange() {144 if (viewPortChanged && !excuteing) {145 excuteing = true;146 viewPortChanged = false;147 excute(event.getViewport());148 setTimeout(function () {149 excuteing = false; 150 checkViewPortChange();151 }, 20);152 }153}154function excute(e, data) {155 if (e) {156 _viewSize = e;157 }158 data = data || _data;159 var len = data.length, item;160 if (len <= 0) {return; }161 requireLazy(['common.js.jquery'], function ($) {162 var len = data.length, item;163 while (len--) {164 item = data[len];165 if (item.offsetTop == undefined) {166 item.offsetTop = findValideTop(item.elem);167 }168 if (_viewSize.scrollTop > (item.offsetTop - _viewSize.height - 10)) {169 //顺序很重要,如果删除在callback之后 ,如果callback有错,导致删除不成功。170 data.splice(len, 1);171 item.callback(item.elem);172 }173 //如果是手动执行且未执行显示,需要把元素添加到_data,以便viewport.change发生时再次调用 174 else if (!e) {175 _data.push(data[len]);176 }177 }178 });179}...

Full Screen

Full Screen

comments_script.js

Source:comments_script.js Github

copy

Full Screen

1import { getCookie } from 'util.js'2import { tinymceInit } from './tinymce_script'3function removeComment(id) {4 var queue = $('.CommentBlock[comment_id="{0}"]'.format(id)).toArray()5 while (queue.length > 0) {6 var headCommentJquery = $(queue.shift())7 var commentId = headCommentJquery.attr('comment_id')8 queue = queue.concat($('.CommentBlock[reply_to_comment_id="{0}"]'.format(commentId)).toArray())9 headCommentJquery.remove()10 }11}12function addCommentRelatedListener() {13 tinymceInit()14 $('code').addClass('prettyprint')15 PR.prettyPrint()16 $('.likeCommentButton').on('click', function() {17 if (is_authenticated) {18 var $this = $(this)19 var new_num = parseInt($this.next().text()) + 120 $this.next().text(new_num.toString())21 $this.off('click')22 $this.css('color', '#6495ED')23 $this.on('click', function() {24 layer.msg('already liked', {25 icon: 6,26 time: 800,27 })28 })29 $.ajax({30 type: 'POST',31 url: '',32 data: {33 csrfmiddlewaretoken: getCookie('csrftoken'),34 operation: 'like_comment',35 comment_id: $this.attr('comment_id'),36 },37 })38 } else39 layer.msg('<span style="color: #ECECEC">You need to <a href="/sign-in" style="color: #ECECEC; text-decoration: underline">log in</a> first</span>')40 })41 $('.delete_comment_button').on('click', function() {42 if (is_authenticated) {43 var index = layer.load(0, {44 shade: 0.1845 }) //0 represent the style, can be 0-246 var commentId = this.value47 $.ajax({48 type: 'POST',49 url: '',50 data: {51 csrfmiddlewaretoken: getCookie('csrftoken'),52 operation: 'delete_comment',53 comment_id: commentId,54 document_id: $('button[name="document_id"]').val(),55 },56 success: function(data) {57 // $("#comment_update_div").html(data)58 // addCommentRelatedListener()59 removeComment(commentId)60 layer.close(index)61 }62 })63 }64 })65 $('.reply_comment_button').on('click', function() {66 $(this).parents('blockquote').find('.reply_comment_form').slideToggle({67 duration: 180,68 start: function() {69 if ($(this).is(':hidden')) {70 // tinyMCE.activeEditor.setContent('')71 } else {72 $('.reply_comment_form').not($(this)).slideUp(180)73 // for (editor in tinyMCE.editors)74 // tinyMCE.editors[editor].setContent('')75 }76 }77 })78 })79 $('.post_comment_reply_button').on('click', function() {80 if (is_authenticated) {81 var is_public = !this.classList.contains('anonymously_post_comment_reply_button')82 var $thisButton = $(this)83 var index = layer.load(0, {84 shade: 0.1885 }) //0代表加载的风格,支持0-286 $.ajax({87 type: 'POST',88 url: '',89 data: {90 csrfmiddlewaretoken: getCookie('csrftoken'),91 operation: 'comment',92 comment_content: $thisButton.parents('form').find('textarea[name="comment_content"]').val(),93 document_id: $('button[name="document_id"]').val(),94 reply_to_comment_id: $thisButton.val(),95 is_public: is_public,96 },97 success: function(data) {98 $('#comment_update_div').html(data)99 // 修改html内容后,有关的事件监听会被自动删除,因此需要重新添加事件监听100 addCommentRelatedListener()101 layer.close(index)102 }103 })104 } else105 layer.msg('<span style="color: #ECECEC">You need to <a href="/sign-in" style="color: #ECECEC; text-decoration: underline">log in</a> first</span>')106 })107}108function enableRefreshCommentButton() {109 $('#refresh_comment_button').on('click', function() {110 $.ajax({111 type: 'POST',112 url: '',113 data: {114 csrfmiddlewaretoken: getCookie('csrftoken'),115 operation: 'refresh',116 document_id: $('button[name="document_id"]').val(),117 },118 success: function(data) {119 $('#comment_update_div').html(data)120 addCommentRelatedListener()121 },122 })123 })124}125function enablePostCommentButton() {126 $('.post_comment_button').on('click', function() {127 if (is_authenticated) {128 var is_public = !this.classList.contains('anonymously_post_comment_button')129 var index = layer.load(0, {130 shade: 0.18131 }) //0代表加载的风格,支持0-2132 var activeEditor = tinyMCE.activeEditor133 $.ajax({134 type: 'POST',135 url: '',136 data: {137 csrfmiddlewaretoken: getCookie('csrftoken'),138 operation: 'comment',139 comment_content: $('textarea[name="comment_content"]').val(),140 document_id: $('button[name="document_id"]').val(),141 is_public: is_public,142 },143 success: function(data) {144 $('#comment_update_div').html(data)145 addCommentRelatedListener() // 修改html内容后,有关的事件监听会被自动删除,因此需要重新添加事件监听146 activeEditor.setContent('') // $("textarea[name='comment_content']").val("")147 layer.close(index)148 }149 })150 } else151 layer.msg('<span style="color: #ECECEC">You need to <a href="/sign-in" style="color: #ECECEC; text-decoration: underline">log in</a> first</span>')152 })153 if (window.hasOwnProperty('MathJax'))154 MathJax.Hub.Queue(['Typeset', MathJax.Hub])155}...

Full Screen

Full Screen

QueueList.js

Source:QueueList.js Github

copy

Full Screen

1/**2 * Created with JetBrains WebStorm.3 * User: john4 * Date: 13-2-195 * Time: 下午9:566 * To change this template use File | Settings | File Templates.7 */8define(['jquery','../Queue',winSize+'/QueueInfo'],function($,Queue,QueueInfo){9 var QueueList = function(props)10 {11 QueueList.superClass.constructor.call(this, props);12 this.init();13 };14 Q.inherit(QueueList, Q.DisplayObjectContainer);15 QueueList.prototype.init = function(){16 this.width = 577;17 this.height = 307;18 //每条任务信息起始坐标19 this.startX = 4;20 this.startY = 4;21 //每条任务信息高度22 this.queueHeight = 115;23 //每条任务信息间距24 this.queueMargin = 5;25 this.queues = Array();26 this.queueIndex = 0;27 };28 QueueList.prototype.click = function(eventx,eventy){29 //eventxy为实际屏幕坐标,30 // 先转换为QueueList在QueueContainer中的相对坐标31 var local = this.localToGlobal(0, 0);32 var clickx = eventx - local.x;33 var clicky = eventy - local.y;34 //将得到的相对坐标除以当前缩放值,得到设计坐标35 clicky = clicky / Views.MainView.queueContainer.scaleY;36 var id = this.getIdByPos(clicky);37 if(id>=0&&id<this.queueIndex) this.setQueueSelected(id);38 };39 ///传递设计坐标,获取列表元素Id40 QueueList.prototype.getIdByPos= function(y){41 for(var i=0;i<this.queueIndex;i++){42 var pymin = this.queues[i].y;43 var pymax = (this.queues[i].y + this.queueHeight);44 if(y>=pymin&&y<=pymax) return i;45 }46 return -1;47 };48 QueueList.prototype.addQueue = function(type,complate,content){49 var queue = new Queue();50 queue.id = this.queueIndex;51 queue.Type = type;52 queue.Complate = complate;53 queue.Content = content;54 var px = this.startX;55 var py = this.startY + (this.queueHeight + this.queueMargin)*this.queueIndex;56 this.height = this.startY + (this.queueHeight + this.queueMargin)*(this.queueIndex+1);57 this.queues[this.queueIndex] = new QueueInfo({x:px,y:py},queue);58 this.addChildAt(this.queues[this.queueIndex],1);59 this.queueIndex++;60 //this.DrawQueueInfo();61 };62 QueueList.prototype.setQueueSelected = function(id){63 //trace(id);64 for(var i=0;i<this.queueIndex;i++){65 this.queues[i].setCancelStatus();66 if(this.queues[i].queue.id == id) this.queues[i].setSelectedStatus();67 }68 };69 QueueList.prototype.DrawQueueInfo = function(){70 var px = 4;71 for(var i=0;i<this.queueIndex;i++){72 var py = 4 + (115 + 5)*i;73 var queueInfo = new QueueInfo({x:px,y:py},this.queues[i]);74 this.addChildAt(queueInfo,1);75 }76 };77 return QueueList;...

Full Screen

Full Screen

imageflip.js

Source:imageflip.js Github

copy

Full Screen

1(function() {2 // try http://api.jquery.com/jquery.queue/3 // Set up glitter functionality4 $.fn.fadeloop = function(options) {5 var6 settings = {7 timeout: 1500,8 timein: 1500,9 wait: 2000,10 timescale: 3,11 loop: true12 };13 $.extend(settings, options);14 var $elem = $(this)15 var fn = function() {16 $elem.fadeOut(settings.timeout).fadeIn(settings.timein);17 };18 fn();19 if (settings.loop)20 setInterval(fn, settings.timescale * settings.wait);21 };22 // Attach glitter23 $('.glitter .glitter-item').each(function(i, elem) {24 var wait = function() {25 return (Math.random(0, 2) + i) * 1000;26 }27 var waitI = wait();28 $(elem).fadeloop({29 wait: waitI30 });31 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add("queue", { prevSubject: true }, (subject, fn) => {2 Cypress.log({3 consoleProps: () => subject4 });5 return cy.wrap(subject).queue(fn);6});7Cypress.Commands.add("dequeue", { prevSubject: true }, subject => {8 Cypress.log({9 consoleProps: () => subject10 });11 return cy.wrap(subject).dequeue();12});13Cypress.Commands.add("clearQueue", { prevSubject: true }, subject => {14 Cypress.log({15 consoleProps: () => subject16 });17 return cy.wrap(subject).clearQueue();18});19Cypress.Commands.add("isInQueue", { prevSubject: true }, (subject, fn) => {20 Cypress.log({21 consoleProps: () => subject22 });23 return cy.wrap(subject).isInQueue(fn);24});25Cypress.Commands.add("queue", { prevSubject: true }, (subject, fn) => {26 Cypress.log({27 consoleProps: () => subject28 });29 return cy.wrap(subject).queue(fn);30});31Cypress.Commands.add("queue", { prevSubject: true }, (subject, fn) => {32 Cypress.log({33 consoleProps: () => subject34 });35 return cy.wrap(subject).queue(fn);36});37Cypress.Commands.add("queue", { prevSubject: true }, (subject, fn) => {38 Cypress.log({

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('queue', { prevSubject: 'optional' }, (subject, queueName, fn) => {2 if (subject) {3 return cy.wrap(subject, { log: false }).queue(queueName, fn);4 }5 return cy.queue(queueName, fn);6});7Cypress.Commands.add('dequeue', { prevSubject: 'optional' }, (subject, queueName) => {8 if (subject) {9 return cy.wrap(subject, { log: false }).dequeue(queueName);10 }11 return cy.dequeue(queueName);12});13Cypress.Commands.add('clearQueue', { prevSubject: 'optional' }, (subject, queueName) => {14 if (subject) {15 return cy.wrap(subject, { log: false }).clearQueue(queueName);16 }17 return cy.clearQueue(queueName);18});19Cypress.Commands.add('queue', { prevSubject: 'optional' }, (subject, queueName, fn) => {20 if (subject) {21 return cy.wrap(subject, { log: false }).queue(queueName, fn);22 }23 return cy.queue(queueName, fn);24});25Cypress.Commands.add('dequeue', { prevSubject: 'optional' }, (subject, queueName) => {26 if (subject) {27 return cy.wrap(subject, { log: false }).dequeue(queueName);28 }29 return cy.dequeue(queueName);30});31Cypress.Commands.add('clearQueue', { prevSubject: 'optional' }, (subject, queueName) => {32 if (subject) {33 return cy.wrap(subject, { log: false }).clearQueue(queueName);34 }35 return cy.clearQueue(queueName);36});

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('test', () => {2 it('test', () => {3 cy.get('#email1').type('test');4 cy.get('#email1').queue(() => {5 debugger;6 });7 cy.get('#email1').type('test');8 });9});10describe('test', () => {11 it('test', () => {12 cy.get('#email1').type('test');13 cy.get('#email1').dequeue();14 cy.get('#email1').type('test');15 });16});17describe('test', () => {18 it('test', () => {19 cy.get('#email1').type('test');20 cy.get('#email1').clearQueue();21 cy.get('#email1').type('test');22 });23});24describe('test', () => {25 it('test', () => {26 cy.get('#email1').type('test');27 cy.get('#email1').promise();28 cy.get('#email1').type('test');29 });30});31describe('test', () => {32 it('test', () => {33 cy.get('#email1').type('test');34 cy.get('#email1').promise('promise');35 cy.get('#email1').type('test');36 });37});38describe('test', () => {39 it('test', () => {40 cy.get('#email1').type('test');41 cy.get('#email1').promise('state');42 cy.get('#email1').type('test');43 });44});45describe('test', () => {46 it('test

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Cypress Queue', function() {2 it('Queue test', function() {3 cy.get('input[name="q"]').type('Cypress')4 cy.get('input[name="btnK"]').click()5 cy.get('h1').should('have.text','cy.queue()')6 })7})8Cypress.on('window:before:load', win => {9 win.eval('var jQuery = $ = Cypress.$ = require("jquery");')10})11{12}13{14 "devDependencies": {15 }16}17module.exports = (on, config) => {18 on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'))19}

Full Screen

Using AI Code Generation

copy

Full Screen

1const $ = Cypress.$.bind(Cypress)2const $el = $('div#div1')3const $el2 = $('div#div2')4const $el3 = $('div#div3')5const $el4 = $('div#div4')6const $el5 = $('div#div5')7const $el6 = $('div#div6')8const $el7 = $('div#div7')9const $el8 = $('div#div8')10const $el9 = $('div#div9')11const $el10 = $('div#div10')12const $el11 = $('div#div11')13const $el12 = $('div#div12')14const $el13 = $('div#div13')15const $el14 = $('div#div14')16const $el15 = $('div#div15')17const $el16 = $('div#div16')18const $el17 = $('div#div17')19const $el18 = $('div#div18')20const $el19 = $('div#div19')21const $el20 = $('div#div20')22const $el21 = $('div#div21')23const $el22 = $('div#div22')24const $el23 = $('div#div23')25const $el24 = $('div#div24')26const $el25 = $('div#div25')27const $el26 = $('div#div26')28const $el27 = $('div#div27')29const $el28 = $('div#div28')30const $el29 = $('div#div29')31const $el30 = $('div#div30')32const $el31 = $('div#div31')33const $el32 = $('div#div32')34const $el33 = $('div#div33')35const $el34 = $('div#div34')36const $el35 = $('div#div35')37const $el36 = $('div#div36')38const $el37 = $('div#div37')39const $el38 = $('div#div38')40const $el39 = $('div#div39')41const $el40 = $('div#div40')42const $el41 = $('div#div41')43const $el42 = $('div#div42')44const $el43 = $('div#div43')45const $el44 = $('div#div44')46const $el45 = $('div

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('#myButton').click().queue(function (next) {2 next();3});4cy.get('#myButton').click().delay(1000).queue(function (next) {5 next();6});7cy.get('#myButton').click().queue(function (next) {8 next();9}).dequeue();10cy.get('#myButton').click().queue(function (next) {11 next();12}).promise('fx');13cy.get('#myButton').click().queue(function (next) {14 next();15}).when();16cy.get('#myButton').click().queue(function (next) {17 next();18}).noop();19cy.get('#myButton').click().queue(function (next) {20 next();21}).isReady();22cy.get('#myButton').click().queue(function (next) {23 next();24}).readyWait();25cy.get('#myButton').click().queue(function (next) {26 next();27}).readyException();28cy.get('#myButton').click().queue(function (next) {29 next();30}).access();31cy.get('#myButton').click().queue(function (next) {32 next();33}).acceptData();34cy.get('#myButton').click().queue(function (next) {

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('queue', { prevSubject: 'optional' }, (subject, fn) => {2 Cypress.log({3 consoleProps: () => {4 return {5 }6 },7 })8 return cy.wrap(subject, { log: false }).then((subject) => {9 Cypress.queue.push(fn)10 if (Cypress.queue.length === 1) {11 return Cypress.queue.shift()(subject)12 }13 })14})15Cypress.Commands.add('dequeue', { prevSubject: 'optional' }, (subject) => {16 Cypress.log({17 consoleProps: () => {18 return {19 }20 },21 })22 return cy.wrap(subject, { log: false }).then((subject) => {23 if (Cypress.queue.length > 0) {24 return Cypress.queue.shift()(subject)25 }26 })27})28Cypress.Commands.add('clearQueue', { prevSubject: 'optional' }, (subject) => {29 Cypress.log({30 consoleProps: () => {31 return {32 }33 },34 })35 return cy.wrap(subject, { log: false }).then((subject) => {36 })37})38Cypress.Commands.add('chain', { prevSubject: 'optional' }, (subject, fn) => {39 Cypress.log({40 consoleProps: () => {41 return {42 }43 },44 })45 return cy.wrap(subject, { log: false }).then((subject) => {46 cy.queue(subject, fn).then(() => {47 cy.dequeue()48 })49 })50})51Cypress.Commands.add('chain', { prev

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('The main page', function() {2 it('successfully loads', function() {3 })4})5describe('The main page', function() {6 it('successfully loads', function() {7 })8})9describe('The main page', function() {10 it('successfully loads', function() {11 })12})13describe('The main page', function() {14 it('successfully loads', function() {15 })16})17describe('The main page', function() {18 it('successfully loads', function() {19 })20})21describe('The main page', function() {22 it('successfully loads', function() {23 })24})25describe('The main page', function() {26 it('successfully loads', function() {27 })28})29describe('The main page', function() {30 it('successfully loads', function() {31 cy.visit('

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful