-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incremental sugarcoat resources #31
Open
ShivanKaul
wants to merge
5
commits into
master
Choose a base branch
from
incremental-sugarcoat-resources
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3cb3a7d
[WIP] SugarCoat resources
ShivanKaul 77785a5
Add raw sugarcoat resources + update URL
ShivanKaul 9a931e7
Test URL for adblock lists
ShivanKaul d0b24ad
Incremental testing for sugarcoat
ShivanKaul 89ceccd
Add 10 websites for sugarcoat
ShivanKaul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
const metadataJsonFile = "metadata.json"; | ||
const resourcesDir = "resources"; | ||
|
||
console.debug(`Creating ${metadataJsonFile}...`); | ||
const resources = fs.readdirSync(resourcesDir); | ||
const metadataList = resources.map((file) => { | ||
return { | ||
name: path.basename(file, ".js"), | ||
aliases: [path.basename(file, ".js")], | ||
kind: { mime: "application/javascript" }, | ||
resourcePath: path.basename(file), | ||
}; | ||
}); | ||
|
||
console.debug(`Writing ${metadataJsonFile}... `); | ||
// Pretty print out | ||
fs.writeFileSync(metadataJsonFile, JSON.stringify(metadataList, null, 4)); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,162 @@ | ||
[ | ||
] | ||
{ | ||
"name": "sugarcoat-5bfb0dd10b7c6d7c07690f78ba444e1b", | ||
"aliases": [ | ||
"sugarcoat-5bfb0dd10b7c6d7c07690f78ba444e1b" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-5bfb0dd10b7c6d7c07690f78ba444e1b.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-5e95376640055da26becf35ea98d15e6", | ||
"aliases": [ | ||
"sugarcoat-5e95376640055da26becf35ea98d15e6" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-5e95376640055da26becf35ea98d15e6.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-AppMeasurement_Module_AudienceManagement.min", | ||
"aliases": [ | ||
"sugarcoat-AppMeasurement_Module_AudienceManagement.min" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-AppMeasurement_Module_AudienceManagement.min.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-EXc2f2c81d843441bfbe3ef094a9cff39d-libraryCode_source.min", | ||
"aliases": [ | ||
"sugarcoat-EXc2f2c81d843441bfbe3ef094a9cff39d-libraryCode_source.min" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-EXc2f2c81d843441bfbe3ef094a9cff39d-libraryCode_source.min.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-apstag", | ||
"aliases": [ | ||
"sugarcoat-apstag" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-apstag.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-bidbarrel-metacritic-rv.min", | ||
"aliases": [ | ||
"sugarcoat-bidbarrel-metacritic-rv.min" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-bidbarrel-metacritic-rv.min.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-bugsnag.min", | ||
"aliases": [ | ||
"sugarcoat-bugsnag.min" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-bugsnag.min.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-cmp2", | ||
"aliases": [ | ||
"sugarcoat-cmp2" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-cmp2.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-cmp2ui-en", | ||
"aliases": [ | ||
"sugarcoat-cmp2ui-en" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-cmp2ui-en.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-connatix.player", | ||
"aliases": [ | ||
"sugarcoat-connatix.player" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-connatix.player.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-launch-EN3932511771fb4e5e9dd852ae89372b59.min", | ||
"aliases": [ | ||
"sugarcoat-launch-EN3932511771fb4e5e9dd852ae89372b59.min" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-launch-EN3932511771fb4e5e9dd852ae89372b59.min.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-launch-ENb97d7f9d2d4b4720ac9782a711994995.min", | ||
"aliases": [ | ||
"sugarcoat-launch-ENb97d7f9d2d4b4720ac9782a711994995.min" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-launch-ENb97d7f9d2d4b4720ac9782a711994995.min.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-launch-ENfc3256407e714aa29bd08452ca5dead1.min", | ||
"aliases": [ | ||
"sugarcoat-launch-ENfc3256407e714aa29bd08452ca5dead1.min" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-launch-ENfc3256407e714aa29bd08452ca5dead1.min.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-moatheader", | ||
"aliases": [ | ||
"sugarcoat-moatheader" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-moatheader.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-optanon-v1.1.0", | ||
"aliases": [ | ||
"sugarcoat-optanon-v1.1.0" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-optanon-v1.1.0.js" | ||
}, | ||
{ | ||
"name": "sugarcoat-prebid", | ||
"aliases": [ | ||
"sugarcoat-prebid" | ||
], | ||
"kind": { | ||
"mime": "application/javascript" | ||
}, | ||
"resourcePath": "sugarcoat-prebid.js" | ||
} | ||
] |
164 changes: 164 additions & 0 deletions
164
resources/sugarcoat-5bfb0dd10b7c6d7c07690f78ba444e1b.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
{ | ||
const $___mock_426638777e368d36 = {}; | ||
(exports => { | ||
'use strict'; | ||
let isSealed = false; | ||
class Storage { | ||
constructor() { | ||
if (isSealed) { | ||
throw new TypeError('Illegal constructor'); | ||
} | ||
} | ||
get length() { | ||
return Object.keys(this).length; | ||
} | ||
key(index) { | ||
const keys = Object.keys(this); | ||
if (index < 0 || index >= keys.length) { | ||
return null; | ||
} | ||
return keys[index]; | ||
} | ||
getItem(key) { | ||
return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; | ||
} | ||
setItem(key, value) { | ||
this[key] = String(value); | ||
} | ||
removeItem(key) { | ||
delete this[key]; | ||
} | ||
clear() { | ||
const keys = Object.keys(this); | ||
for (const key of keys) { | ||
delete this[key]; | ||
} | ||
} | ||
} | ||
exports.Storage = { | ||
configurable: true, | ||
enumerable: true, | ||
value: Storage, | ||
writable: true | ||
}; | ||
const localStorage = new Storage(); | ||
exports.localStorage = { | ||
configurable: true, | ||
enumerable: true, | ||
get() { | ||
return localStorage; | ||
} | ||
}; | ||
const sessionStorage = new Storage(); | ||
exports.sessionStorage = { | ||
configurable: true, | ||
enumerable: true, | ||
get() { | ||
return sessionStorage; | ||
} | ||
}; | ||
isSealed = true; | ||
})($___mock_426638777e368d36); | ||
(function () { | ||
Bootstrapper.bindDOMParsed(function () { | ||
Bootstrapper.ensEvent.add(['Global: Non Shopping Flow'], function () { | ||
var ensEventContext = this; | ||
if (ensEventContext == window) | ||
ensEventContext = undefined; | ||
var Bootstrapper = window['Bootstrapper']; | ||
var ensightenOptions = Bootstrapper.ensightenOptions; | ||
Bootstrapper.data.resolve([ | ||
'13919', | ||
'59946', | ||
'59947', | ||
'16336', | ||
'13642', | ||
'55415' | ||
], function (manage_13919, manage_59946, manage_59947, manage_16336, manage_13642, manage_55415) { | ||
var ensVar0 = function () { | ||
return manage_13919; | ||
}; | ||
var ensVar1 = function () { | ||
return manage_59946; | ||
}; | ||
var ensVar2 = function () { | ||
return manage_59947; | ||
}; | ||
var ensVar3 = function () { | ||
return manage_16336; | ||
}; | ||
var ensVar4 = function () { | ||
return manage_13642; | ||
}; | ||
var ensVar5 = function () { | ||
return manage_55415; | ||
}; | ||
var onload = function () { | ||
const $___old_c5b4ca906d30de53 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); | ||
try { | ||
if ($___old_c5b4ca906d30de53) | ||
({}.constructor.defineProperty(window, 'localStorage', $___mock_426638777e368d36.localStorage)); | ||
return function () { | ||
window.criteo_q = window.criteo_q || []; | ||
var account_id = ''.split(','), local_accounts_array = [], emailType = 'hashed', customDataObj = {}, setDataObj = undefined, custObj = undefined, emailObj = undefined, loginObj = undefined, accountType = 'name'; | ||
customDataObj['target'] = ensVar3.call(this); | ||
customDataObj['pagetype'] = ensVar4.call(this); | ||
customDataObj['extra_criteo'] = ensVar5.call(this); | ||
var accountObj = { 'event': 'setAccount' }; | ||
if (accountType == 'name') { | ||
accountObj.account = {}; | ||
accountObj.account.an = ensVar0.call(this); | ||
accountObj.account.cn = ensVar1.call(this); | ||
accountObj.account.ln = ensVar2.call(this); | ||
} else { | ||
for (var i = 0; i < account_id.length; i++) | ||
local_accounts_array[i] = parseInt(account_id[i], 10); | ||
accountObj.account = local_accounts_array; | ||
} | ||
var siteTypeObj = { | ||
'event': 'setSiteType', | ||
'type': 'd' ? 'd' : 'd' | ||
}; | ||
if ('') | ||
custObj = { | ||
'event': 'setCustomerId', | ||
'id': '' | ||
}; | ||
if ('') | ||
emailObj = { | ||
'event': emailType === 'plaintext' ? 'setEmail' : 'setHashedEmail', | ||
'email': ''.split(',') | ||
}; | ||
if ('') | ||
loginObj = { | ||
'event': emailType === 'plaintext' ? 'setLogin' : 'setHashedLogin', | ||
'login': ''.split(',') | ||
}; | ||
var viewObj = { 'event': 'viewHome' }; | ||
if ('') | ||
viewObj.user_segment = ''; | ||
if ('') | ||
viewObj.nbra = ''; | ||
if ('') | ||
viewObj.nbrc = ''; | ||
if ('') | ||
viewObj.nbrb = ''; | ||
for (var d in customDataObj) | ||
if (customDataObj.hasOwnProperty(d)) { | ||
setDataObj = customDataObj; | ||
setDataObj.event = 'setData'; | ||
break; | ||
} | ||
criteo_q.push(accountObj, setDataObj, siteTypeObj, custObj, emailObj, loginObj, viewObj); | ||
}.apply(this, arguments); | ||
} finally { | ||
if ($___old_c5b4ca906d30de53) | ||
({}.constructor.defineProperty(window, 'localStorage', $___old_c5b4ca906d30de53)); | ||
} | ||
}; | ||
Bootstrapper.loadScriptCallback('//static.criteo.net/js/ld/ld.js', onload); | ||
}); | ||
}); | ||
}, 2915406, 603887); | ||
}()) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change this once the PR on adblock-lists is merged