This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function trace(...args) { | |
| if (window.console) { | |
| const context = window === this ? console : this; | |
| return (console.trace || console.log).apply(context, args); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Accelerometer https://gist.github.com/videlais/8122721 | |
| // Modernizr | |
| // jQuery | |
| /** | |
| * | |
| * @param {string|HTMLElement|JQuery} blockSelector | |
| * @param {string} layersSelector | |
| * @param {number} [mobileStrength] sensitive from 0 to 1 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;(function () { | |
| /** | |
| * | |
| * @type {function[]} | |
| */ | |
| var onScrollCallbacks = []; | |
| $(window).on('scroll', function onScroll() { | |
| $.each(onScrollCallbacks, function each(index, callback) { | |
| callback(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * queue(window, ['hello', 'queue'], [alert, console.log]) | |
| * | |
| * @param {object} ctx context | |
| * @param {Array} fnArgs arguments | |
| * @param {Array} arguments callbacks | |
| */ | |
| function queue(ctx, fnArgs) { | |
| "use strict"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(function(){document.designMode=('off'===document.designMode?'on':'off')})() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var animation = animate({ | |
| duration: 1000, | |
| frames: 25, | |
| fn: function animationFunction(){} | |
| }); | |
| animation.active(); | |
| animation.inactive(); | |
| function animate(item) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * <element tabs='{"contentActiveClass": "active", "linkActiveClass": "active"}'> | |
| * $('[data-tabs']).simpleTabs(); | |
| * | |
| * <element tabs> | |
| * $('[data-tabs']).simpleTabs({contentActiveClass: "active", linkActiveClass: "active"}); | |
| * | |
| * <element id="some-id"> | |
| * $('#some-id).simpleTabs({contentActiveClass: "active", linkActiveClass: "active"}); | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function reachGoalFor(counterId, ...args) { | |
| const Counters = window.Ya && Ya._metrika && Ya._metrika.counters || []; | |
| const isFirstArgumentRealCounter = counterId && counterId.reachGoal; | |
| const trackCounter = function trackCounter(counter, ...dynamicArgs) { | |
| let _args = dynamicArgs.length && dynamicArgs || args; | |
| if (_args.length) { | |
| counter.reachGoal.apply(counter, _args); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @link https://gist.github.com/zolotykh/3879b7d2354d1de1f57f4b44c4a08821/f30ee1df0be25d619050e312aa2d4ae917330b25 | |
| */ | |
| yaTrack(null, 'GOAL_NAME', {key: 'value'}); // во все счетчики | |
| yaTrack(98765431, 'GOAL_NAME'); // в конкретный id счетчика | |
| yaTrack('98\\d65431|87654\\d{3}', 'GOAL_NAME'); // regex | |
| yaTrack(yaCounter987654321, 'GOAL_NAME'); // наиболее безопасен с точки зрения того, что window.Ya._metrika может измениться | |
| // yaTrack возвращает коллбэк для быстрого пуша |
NewerOlder