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 getScript(url, callback, timeout) { | |
| var timeoutIdx, | |
| s = document.createElement('script'); | |
| s.type = 'text/' + (url.type || 'javascript'); | |
| s.src = url.src || url; | |
| s.async = false; | |
| s.onreadystatechange = s.onload = function() { | |
| // this code handles two scenarios, whether called by onload or onreadystatechange |
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 makeAsyncRequest( | |
| url, | |
| onComplete, | |
| timeout, | |
| postData, | |
| requestHeaders | |
| ) { | |
| var xhr = new (window.XMLHttpRequest || window.ActiveXObject)( | |
| 'MSXML2.XMLHTTP.3.0' | |
| ); |
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
| Array.prototype.diff = function (a) { | |
| return this.filter(function (i) { | |
| return a.indexOf(i) === -1; | |
| }); | |
| }; | |
| // usage: | |
| [1, 2, 3, 4, 5, 6].diff([2, 4, 6]); | |
| // => [1, 3, 5] |
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 util = { | |
| // https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex | |
| escapeRegExp: function(str) { | |
| return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); | |
| }, | |
| hasClass: function(element, selector) { | |
| var s = ' '; | |
| return ( | |
| element.nodeType === 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
| const copyToClipboard = str => { | |
| const el = document.createElement('textarea'); | |
| el.value = str; | |
| el.setAttribute('readonly', ''); | |
| el.style.position = 'absolute'; | |
| el.style.left = '-9999px'; | |
| document.body.appendChild(el); | |
| el.select(); | |
| document.execCommand('copy'); | |
| document.body.removeChild(el); |
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
| $(document).ready( function() { | |
| var x=0; setInterval(function() { | |
| var dots = ""; x++; for (var y=0; y < x%3; y++) {dots+=".";} $("#loading-dots").text(dots); | |
| } , 500); | |
| }); |
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
| $.fn.isBottomInScreen = function (outFn, inFn) { | |
| outFn = outFn || $.noop(); | |
| inFn = inFn || $.noop(); | |
| var $self = $(this); | |
| var inFlag = true; | |
| $(window).on('scroll', function () { | |
| requestAnimationFrame(function () { | |
| if (($self.offset().top + $self.height()) < $(window).scrollTop()) { // element is out of screen | |
| if (inFlag) { | |
| $self.addClass('out').removeClass('in').trigger('out'); |
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
| document.ready = function(f){ | |
| f = f || function(){}; | |
| if (document.readyState == "interactive" || "complete") { | |
| f(); | |
| } else { | |
| document.addEventListener("DOMContentLoaded", function(e) { | |
| f(); | |
| }); | |
| } | |
| } |
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.style { | |
| background-image: linear-gradient(to left, #777dff 0%, #f154ff 50%, #f0357c 100%),linear-gradient(to right, #777dff 0%, #497ce2 50%, #37bdde 100%); | |
| color: transparent; | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| } |
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
| // Avoid `console` errors in browsers that lack a console. | |
| (function() { | |
| var method; | |
| var noop = function () {}; | |
| var methods = [ | |
| 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', | |
| 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', | |
| 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', | |
| 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn' | |
| ]; |