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
console.log("☠️ I'm a malicious script that has been injected into the page and executed ☠️") |
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
<?php | |
$listOfFiles = 'assets_js.txt'; | |
$listOfCheckoutFiles = 'assets_checkout_files.txt'; | |
$outputOfNonCheckoutFiles = 'assets_non-checkout_files.txt'; | |
$files = file($listOfFiles, FILE_IGNORE_NEW_LINES); | |
$checkoutFiles = file($listOfCheckoutFiles , FILE_IGNORE_NEW_LINES); | |
$nonCheckoutFiles = []; |
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
Magento_Checkout/js/discount-codes | |
Magento_Checkout/js/shopping-cart | |
Magento_Checkout/js/region-updater | |
Magento_Checkout/js/sidebar | |
Magento_Checkout/js/checkout-loader | |
Magento_Checkout/js/checkout-data | |
Magento_Checkout/js/proceed-to-checkout | |
Magento_Checkout/js/action/place-order | |
Magento_Checkout/js/action/set-payment-information | |
Magento_Checkout/js/model/shipping-rate-service |
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
$destinationFile = "assets/js.txt"; | |
$name = $asset->getPath(); | |
$nameParts = explode('.', $name); | |
$extension = array_pop($nameParts); | |
if ($extension == 'js') { | |
file_put_contents($destinationFile, $name.PHP_EOL , FILE_APPEND | LOCK_EX); | |
} |
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 contentImgsCache = 'my-content-imgs'; //Set up the name of the cache for the images. This will be different to the normal cache, as images will likely be persisted for longer | |
self.addEventListener('fetch', function(event) { | |
var requestUrl = new URL(event.request.url); | |
//See previous snippets for explanation of this | |
if (requestUrl.origin === location.origin) { | |
if (requestUrl.pathname.startsWith('/photos/')) { | |
event.respondWith(servePhoto(event.request)); | |
return; |
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
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899 | |
//Starting with "Group data together using indexes" snippet in https://gist.github.com/luke-denton/193fd42e9fcfe6e2f1e8b6c4de58dc4e | |
//Basically a complicated way of calling getAll() | |
dbPromise.then(function(db) { | |
var tx = db.transaction('people'); | |
var peopleStore = tx.objectStore('people'); | |
var superheroIndex = peopleStore.index('superhero'); | |
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
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899 | |
//This should all go into an indexed-db index.js file | |
//Again, idb is a plugin used to make working with IndexedDB easier | |
//Difference between this and https://gist.github.com/luke-denton/55be283cbddf6f0c0d362fd95fc9280a, version has been upgraded | |
var dbPromise = idb.open('test-db', 2, function() { | |
switch(upgradeDb.oldVersion) | |
case 0: | |
var keyValStore = upgradeDb.createObjectStore('keyval'); |
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
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899 | |
//Again, following on from https://gist.github.com/luke-denton/55be283cbddf6f0c0d362fd95fc9280a | |
dbPromise.then(function(db) { | |
var tx = db.transaction('keyval', 'readwrite'); | |
var keyValStore = tx.objectStore('keyval'); | |
keyValStore.put('bar', 'foo'); | |
return tx.complete; | |
}).then(function() { |
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
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899 | |
//Following on from https://gist.github.com/luke-denton/55be283cbddf6f0c0d362fd95fc9280a | |
dbPromise.then(function(db) { | |
var tx = db.transaction('keyval'); | |
var keyValStore = tx.objectStore('keyval'); | |
return keyValStore.get('hello'); | |
}).then(function(val) { | |
console.log(val); //Log the value of the key 'hello' |
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
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899 | |
//idb is a plugin that's available to make it easier to work with IndexedDB | |
//This should all go in a new file, called index.js, in a sub-directory called index-db, or something of the like | |
//Open a new database, giving it a name, version number and a callback function | |
var dbPromise = idb.open('test-db', 1, function(upgradeDb) { | |
var keyValStore = upgradeDb.createObjectStore('keyval'); | |
keyValStore.put('world', 'hello'); //Put the value 'world' into key 'hello' (key/value is seeminlgy back-to-front) |
NewerOlder