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
| class RequestQueue { | |
| queue: Promise<void> = Promise.resolve(); | |
| constructor() { | |
| const $this = this; | |
| } | |
| async add(fn: any) { | |
| const $this = this; |
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
| class WorkerTimeout { | |
| worker = null; | |
| constructor(callback, timeout) { | |
| const $this = this; | |
| const blob = new Blob([`setTimeout(() => postMessage(0), ${timeout});`]); | |
| const workerScript = URL.createObjectURL(blob); | |
| $this.worker = new Worker(workerScript); | |
| $this.worker.onmessage = () => { | |
| callback(); | |
| $this.worker.terminate(); |
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
| class WorkerInterval { | |
| worker = null; | |
| constructor(callback, interval) { | |
| const $this = this; | |
| const blob = new Blob([`setInterval(() => postMessage(0), ${interval});`]); | |
| const workerScript = URL.createObjectURL(blob); | |
| $this.worker = new Worker(workerScript); | |
| $this.worker.onmessage = 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
| function doNotThrottleMyTimers() { | |
| const audioContext = new AudioContext(); | |
| const constantSource = audioContext.createConstantSource(); | |
| constantSource.connect(audioContext.destination); | |
| constantSource.start(); | |
| } |
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
| URL = new Proxy(URL, { | |
| construct(target, args: [string]) { | |
| const url: any = new target(...args); | |
| if (url.hash) { | |
| const hashString = url.hash.startsWith('#') ? url.hash.slice(1) : url.hash; | |
| url.hashParams = new URLSearchParams(hashString); | |
| } | |
| // Добавляем свойство pathSegments, разбивая pathname на массив |
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
| XMLHttpRequest = new Proxy( XMLHttpRequest, { | |
| construct( target ) { | |
| const xhr: any = new target(); | |
| ( ( | |
| open, | |
| setRequestHeader, | |
| send, | |
| 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
| WebSocket = new Proxy( WebSocket, { | |
| construct( target, args ) { | |
| return {}; // Safety remove WS from browser =) | |
| } | |
| } ); |
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
| add_action( 'wp', 'woocommerce_set_custom_cookie', 100 ); | |
| add_action( 'woocommerce_add_to_cart_handler', 'woocommerce_set_custom_cookie' ); | |
| function woocommerce_set_custom_cookie() { | |
| setcookie( 'woocommerce_cart_contents_count', WC()->cart->cart_contents_count, 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
| add_action( 'wp_head', 'woo_js_params', 99 ); | |
| function woo_js_params() { | |
| ?> | |
| <script> | |
| <?php | |
| $vars = array( | |
| 'woocommerce' => array( | |
| 'ajax_url' => WC()->ajax_url() , | |
| 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%") , | |
| ) , |
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
| add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' ); | |
| add_action( 'wp_head', 'disable_woo', 99 ); | |
| function disable_woo() { | |
| global $wp_scripts, $wp_styles; | |
| $scripts = array( | |
| 'accounting', | |
| 'wc-jquery-ui-touchpunch', | |
| 'wc-price-slider', | |
| 'flexslider', |
NewerOlder