Commit 4ca7ca1b by Иван Кубота

auth through js api

parent 76daf9f9
var data = require('./skus.json');
var getters = {
"EYESHADOW": function(item) {
var colors = item.colors;
return [item.skuType, item.skuNo, colors[0].colorCode, colors[0].glossIntensity, colors[0].shimmerColorCode, colors[0].shimmerIntensity]
},
"LIPCOLOR": function(item) {
var colors = item.colors;
return [item.skuType, item.skuNo, colors[0].colorCode, colors[0].glossIntensity, colors[0].shimmerColorCode, colors[0].shimmerIntensity]
},
"EYELINER": function(item) {
var colors = item.colors;
return [item.skuType, item.skuNo, colors[0].colorCode, colors[0].glossIntensity, colors[0].shimmerColorCode, colors[0].shimmerIntensity]
}
};
var cols = ['Type', 'SKU ID', 'Color', 'Gloss %', 'Shimmer Color', 'Shimmer %'];
var fs = require('fs');
fs.writeFile('skus.csv',
cols.join(',')+'\n'+
data.results.map(item=> getters[item.skuType](item).join(',')).join('\n'),function(){
});
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Google Sheets API Quickstart</title>
<meta charset="utf-8" />
</head>
<body>
<p>Google Sheets API Quickstart</p>
<!--Add buttons to initiate auth sequence and sign out-->
<button id="authorize_button" style="display: none;">Authorize</button>
<button id="signout_button" style="display: none;">Sign Out</button>
<pre id="content" style="white-space: pre-wrap;"></pre>
<script type="text/javascript">
// Client ID and API key from the Developer Console
var CLIENT_ID = "838942638829-3koe535vg4adclpd01sd3nnmi250h2ra.apps.googleusercontent.com";
var API_KEY = "AIzaSyD13Vbl1iq36HFABoVa27-VcOyqSMYNTZw";//"AIzaSyDx2DNm9fX9VXh6YzKEg5JybYSE6A6dZLg";
// Array of API discovery doc URLs for APIs used by the quickstart
var DISCOVERY_DOCS = ["https://sheets.googleapis.com/$discovery/rest?version=v4"];
// Authorization scopes required by the API; multiple scopes can be
// included, separated by spaces.
var SCOPES = "https://www.googleapis.com/auth/spreadsheets.readonly";
var authorizeButton = document.getElementById('authorize_button');
var signoutButton = document.getElementById('signout_button');
/**
* On load, called to load the auth2 library and API client library.
*/
function handleClientLoad() {
gapi.load('client:auth2', initClient);
}
/**
* Initializes the API client library and sets up sign-in state
* listeners.
*/
function initClient() {
gapi.client.init({
apiKey: API_KEY,
clientId: CLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES
}).then(function () {
// Listen for sign-in state changes.
gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
// Handle the initial sign-in state.
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
authorizeButton.onclick = handleAuthClick;
signoutButton.onclick = handleSignoutClick;
}, function(error) {
appendPre(JSON.stringify(error, null, 2));
});
}
/**
* Called when the signed in status changes, to update the UI
* appropriately. After a sign-in, the API is called.
*/
function updateSigninStatus(isSignedIn) {
if (isSignedIn) {
authorizeButton.style.display = 'none';
signoutButton.style.display = 'block';
listMajors();
} else {
authorizeButton.style.display = 'block';
signoutButton.style.display = 'none';
}
}
/**
* Sign in the user upon button click.
*/
function handleAuthClick(event) {
gapi.auth2.getAuthInstance().signIn();
}
/**
* Sign out the user upon button click.
*/
function handleSignoutClick(event) {
gapi.auth2.getAuthInstance().signOut();
}
/**
* Append a pre element to the body containing the given message
* as its text node. Used to display the results of the API call.
*
* @param {string} message Text to be placed in pre element.
*/
function appendPre(message) {
var pre = document.getElementById('content');
var textContent = document.createTextNode(message + '\n');
pre.appendChild(textContent);
}
/**
* Print the names and majors of students in a sample spreadsheet:
* https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
*/
function listMajors() {
gapi.client.sheets.spreadsheets.values.get({
spreadsheetId: '1EkUKPUf2uedFd55lUj4_LQOb1EUXfcN8j96KU1qTy3w',
range: 'SKU!A2:F',
}).then(function(response) {
debugger
var range = response.result;
if (range.values.length > 0) {
appendPre('Name, Major:');
for (i = 0; i < range.values.length; i++) {
var row = range.values[i];
// Print columns A and E, which correspond to indices 0 and 4.
appendPre(row[0] + ', ' + row[4]);
}
} else {
appendPre('No data found.');
}
}, function(response) {
appendPre('Error: ' + response.result.error.message);
});
}
</script>
<script async defer src="https://apis.google.com/js/api.js"
onload="this.onload=function(){};handleClientLoad()"
onreadystatechange="if (this.readyState === 'complete') this.onload()">
</script>
</body>
</html>
\ No newline at end of file
...@@ -4,6 +4,11 @@ License: MPL 2.0 ...@@ -4,6 +4,11 @@ License: MPL 2.0
Contact: zibx@quokka.pub Contact: zibx@quokka.pub
*/ */
/*
Observable Store based in 2016 April by Ivan Kubota
License: MPL 2.0
Contact: zibx@quokka.pub
*/
const isEqual = function(original, fn) { const isEqual = function(original, fn) {
return function(val) { return function(val) {
fn(val===original); fn(val===original);
...@@ -14,6 +19,13 @@ const isContain = function(original, fn) { ...@@ -14,6 +19,13 @@ const isContain = function(original, fn) {
fn((val||[]).indexOf(original)>-1); fn((val||[]).indexOf(original)>-1);
} }
}; };
/*
-- DESIGN --
Store MUST notify all subscribers on each change
Store MUST NOT notify subscribers if it does not change
*/
const Store = function(cfg) { const Store = function(cfg) {
Observable.call(this); Observable.call(this);
this.events = new Observable(); this.events = new Observable();
...@@ -99,14 +111,21 @@ Store.prototype = { ...@@ -99,14 +111,21 @@ Store.prototype = {
setParent: function(parent, key, item){ setParent: function(parent, key, item){
this.parent = new StoreParent(parent, key, item); this.parent = new StoreParent(parent, key, item);
}, },
bindings: function() {
var out = {};
for(var k in this._props){
out[k] = this.bind(k);
}
return out;
},
item: function(key, item){ item: function(key, item){
let subStore = new Store(item?item:key); let subStore = new Store(item?item:key);
subStore.setParent(this, key, item); subStore.setParent(this, key, item);
return subStore; return subStore;
}, },
array: function(key){ array: function(key){
let arrayStore = new ArrayStore(this.get(key)) let arrayStore = new ArrayStore(this.get(key));
arrayStore.setParent(this, key) arrayStore.setParent(this, key);
return arrayStore; return arrayStore;
}, },
experimental: false, experimental: false,
...@@ -235,14 +254,34 @@ Store.prototype = { ...@@ -235,14 +254,34 @@ Store.prototype = {
sub: function(key, fn, suppresFirstCall) { sub: function(key, fn, suppresFirstCall) {
var un; var un;
if(Array.isArray(key)){ if(Array.isArray(key)){
var wrap = () => fn.apply(this, key.map(key=>key instanceof StoreBinding ? key.get() : this.get(key))); var _self = this;
var args = new Array(key.length);
var caller = function() {
return fn.apply(_self, args);
};
var wrap = function(i){
return function(val) {
args[i] = val;
return caller();
};
};
var uns = []; var uns = [];
for( var i = 0, _i = key.length; i < _i; i++ ){ for( var i = 0, _i = key.length; i < _i; i++ ){
if(key[i] instanceof StoreBinding){ if(key[i] instanceof StoreBinding){
uns.push(key[i].sub(wrap)); uns.push(key[i].sub(wrap(i)));
args[i] = key[i].get();
}else if(key[i] instanceof HookPrototype){
uns.push(key[i].hook(wrap(i)));
args[i] = key[i].get();
}else{ }else{
uns.push(this.on( key[ i ], wrap )) uns.push(this.on( key[ i ], wrap(i) ));
args[i] = this.get(key[ i ]);
} }
} }
!suppresFirstCall && wrap(); !suppresFirstCall && wrap();
return function() { return function() {
...@@ -326,6 +365,14 @@ StoreBinding.prototype = { ...@@ -326,6 +365,14 @@ StoreBinding.prototype = {
}, },
bind: function(key) { bind: function(key) {
return new StoreBinding(this.store, this.key+'.'+key); return new StoreBinding(this.store, this.key+'.'+key);
},
hook: function(draw) {
return this.sub(function(val){
draw(val);
});
},
array: function() {
return this.store.array(this.key);
} }
}; };
Store.prototype = Object.assign(new Observable, Store.prototype); Store.prototype = Object.assign(new Observable, Store.prototype);
...@@ -449,7 +496,17 @@ HookPrototype.prototype = { ...@@ -449,7 +496,17 @@ HookPrototype.prototype = {
x.sub = (fn)=> this.hook(fn); x.sub = (fn)=> this.hook(fn);
return x; return x;
}, },
hook: function(fn) { this.subscribers.push(fn); fn(this.get()); }, hook: function(fn) {
this.subscribers.push(fn);
fn(this.get());
var _self = this;
return function() {
var index = _self.subscribers.indexOf(fn);
if(index>-1){
_self.subscribers.splice( index, 1 );
}
}
},
_emit: function(oldVal, val) { _emit: function(oldVal, val) {
var subscribers = this.subscribers; var subscribers = this.subscribers;
for( var i = 0, _i = subscribers.length; i < _i; i++ ){ for( var i = 0, _i = subscribers.length; i < _i; i++ ){
...@@ -470,69 +527,142 @@ var HookFactory = function(accessor) { ...@@ -470,69 +527,142 @@ var HookFactory = function(accessor) {
return Hook; return Hook;
}; };
Store.getValue = function(val) {
if(val instanceof StoreBinding){
return val.hook();
}else{
return val;
}
};
Store.Value = { Store.Value = {
Boolean: new HookFactory({ Boolean: new HookFactory({
setter: function(val) { return !!val; }, setter: function(val) { return !!val; },
toggle: function() { this.set(!this.get()); } toggle: function() { this.set(!this.get()); }
}), }),
Number: new HookFactory({ Number: new HookFactory({
setter: function(val) { return val-0; }
}),
String: new HookFactory({
setter: function(val) { return val+''; }
}),
Integer: new HookFactory({
setter: function(val) { return val|0; } setter: function(val) { return val|0; }
}) }),
Any: new HookFactory(),
Function: new HookFactory()
}; };
Store.HookPrototype = HookPrototype; Store.HookPrototype = HookPrototype;
/*
-- DESIGN --
Array DOES NOT notify the store when it's item changes
Array MUST notify itself when item is added or removed
Array MUST notify when it is reordered
Array Item MUST be observed itself
*/
var getter = function( i ){ return this[i]; };
var fns = Array.prototype;
const ArrayStore = function (cfg) { const ArrayStore = function(cfg) {
Store.call(this, cfg); Store.call(this, cfg);
if( !('get' in this._props) ){
Object.defineProperties( this._props, {
get: { value: getter, enumerable: false }
} );
}
this.length = this._props.length;
}; };
ArrayStore.prototype = { ArrayStore.prototype = {
push: function (val) { length: 0,
var changeList = []; indexOf: function (a) {
changeList.push(['', this._props]) return this._props.indexOf(a);
},
toArray: function () {
return this._props;
},
_fireAdd: function (item, pos) {
var arr = this._props;
this.fire('add', item, pos > 0 ? arr.get(pos-1) : null, pos < this.length - 1 ? arr.get(pos+1) : null, pos)
},
_fireRemove: function (item, pos) {
var arr = this._props;
this.fire('remove', item, pos > 0 ? arr.get(pos-1) : null, pos < this.length ? arr.get(pos) : null, pos)
},
push: function (item) {
// single item push only
var out = this._props.push(item);
this._fireAdd(item, this.length++);
return out;
},
unshift: function (item) {
// single item unshift only
var out = this._props.unshift(item);
this.length++;
this._fireAdd(item, 0);
return out;
},
shift: function(){
var pos = --this.length,
arr = this._props,
item = arr.shift();
this.set(this.getLength(), val, changeList); this._fireRemove(item, 0);
this._notify(changeList); return item;
return this;
}, },
pop: function () { pop: function () {
var changeList = []; var pos = --this.length,
changeList.push(['', this._props]); arr = this._props,
var out = this.get(this.getLength()-1); item = arr.pop();
this.set(this.getLength()-1, void 0, changeList);
this._props.pop(); this._fireRemove(item, pos);
this._notify(changeList); return item;
},
splice: function(start, count){
var i, _i, newItems = fns.slice.call(arguments,2 ), out = [];
for(i = 0;i<count; i++)
out.push(this.remove(start));
for(i = 0, _i = newItems.length; i < _i; i++)
this.insert(newItems[i], i + start);
return out; return out;
}, },
remove: function(item) { /*
var idx = this._props.indexOf(item); set - updates element
if(idx>-1){ @arg pos: position of element. defined on [0..length]
var changeList = []; @arg item: element to set
changeList.push(['', this._props]);
this._props.splice(idx,1); @return element that was in that position before
//this.set(this.getLength()-1, void 0, changeList); */
this._notify(changeList); set: function(pos, item){
if(pos === this.length){
this.push( item );
return void 0; // for same behavior we return empty array
} }
return this; return this.splice(pos, 1, item)[0];
}, },
slice: function () {}, iterator: function(start){
splice: function () {}, return new Iterator(this, start);
getLength: function () {
return this._props.length;
}, },
update: function() { remove: function(pos){
var changeList = []; var item = this._props.splice(pos,1)[0];
changeList.push(['', this._props]); this.length--;
this._notify(changeList); this._fireRemove(item, pos);
return this; return item;
}, },
'~destructor': function() { insert: function(item, pos){
this._listeners = this.events = this._props = null; this._props.splice(pos, 0, item);
this.length++;
this._fireAdd(item, pos)
},
forEach: function (fn) {
return this._props.forEach(fn);
} }
}; };
ArrayStore.prototype = Object.assign(new Store(), ArrayStore.prototype); ArrayStore.prototype = Object.assign(new Store(), ArrayStore.prototype);
typeof module === 'object' && (module.exports = Store); typeof module === 'object' && (module.exports = Store);
(typeof window === 'object') && (window.Store = Store); (typeof window === 'object') && (window.Store = Store);
\ No newline at end of file
...@@ -7,6 +7,8 @@ var colorsFromPoints = function(points, ctx, where, k, production, notThis, part ...@@ -7,6 +7,8 @@ var colorsFromPoints = function(points, ctx, where, k, production, notThis, part
deltaSkin = 8; deltaSkin = 8;
if(partName === 'eyes') if(partName === 'eyes')
deltaSkin = 15; deltaSkin = 15;
if(partName === 'other')
deltaSkin = 4;
var minX = Infinity, minY = Infinity, var minX = Infinity, minY = Infinity,
maxX = -Infinity, maxY = -Infinity; maxX = -Infinity, maxY = -Infinity;
...@@ -227,7 +229,14 @@ var extractColors = function( ctx, where, k, production, notThis, partName){ ...@@ -227,7 +229,14 @@ var extractColors = function( ctx, where, k, production, notThis, partName){
return triangle.apply( null, polygon ); return triangle.apply( null, polygon );
} ) ); } ) );
return colorsFromPoints(points, ctx, where, k, production, notThis, partName); var clrs = colorsFromPoints(points, ctx, where, k, production, notThis, partName);
if(partName === 'blush' && clrs.length === 0){
clrs = colorsFromPoints(points, ctx, where, k, production, notThis, 'other');
if(clrs.length === 0){
clrs = notThis;
}
}
return clrs;
}; };
var colorSort = function(a,b){return (-(a[2]-b[2]))+(-(a[1]-b[1])/2)}; var colorSort = function(a,b){return (-(a[2]-b[2]))+(-(a[1]-b[1])/2)};
var similarColor = 5;//0.05; var similarColor = 5;//0.05;
...@@ -304,6 +313,9 @@ var extractor = function(partName, ctx, from, k, production, notThis) { ...@@ -304,6 +313,9 @@ var extractor = function(partName, ctx, from, k, production, notThis) {
colors = [{color: labToRgb.apply(null, mean), hsv: mean}] colors = [{color: labToRgb.apply(null, mean), hsv: mean}]
} }
if(production !== 0 && production !== void 0){ if(production !== 0 && production !== void 0){
if(partName[0] !== '_' && partName !== 'skin'){
document.getElementById( partName + '-bg' ).style.display = colors.length ? 'block' : 'none';
}
var clrs = document.getElementById(partName+'-bg').querySelector('.colors'); var clrs = document.getElementById(partName+'-bg').querySelector('.colors');
clrs && clrs.parentNode.removeChild(clrs); clrs && clrs.parentNode.removeChild(clrs);
......
Type,SKU ID,Color,Gloss %,Shimmer Color,Shimmer %
EYESHADOW,Eyeshadow-DarkChestnut-Glitter,#986960,0,,85
LIPCOLOR,Lipstick-Blush-Sheer,#DE5D83,55,#eeeeee,50
LIPCOLOR,Lipstick-Chestnut-Sheer,#CD5C5C,65,#eeeeee,50
EYELINER,Eyeliner-PearlAqua-Matte,#80CBB7,0,,0
EYELINER,Eyeliner-PayneGrey-Matte,#536878,0,,0
LIPCOLOR,Lipstick-RoseGold-Sheer,#BF746B,65,#eeeeee,50
LIPCOLOR,Lipstick-TerraCotta-Sheer,#E2725B,75,#eeeeee,50
LIPCOLOR,Lipstick-RosyBrown-Matte,#BC8F8F,50,#eeeeee,50
EYESHADOW,Eyeshadow-RoyalPurple-Glitter,#7851A9,0,,85
EYESHADOW,Eyeshadow-Shadow-Sheer,#8A795D,0,,85
LIPCOLOR,Lipstick-DarkScarlet-Satin,#5c0b23,50,#eeeeee,50
LIPCOLOR,Lipstick-PansyPurple-Satin,#78184A,50,#eeeeee,50
EYESHADOW,Eyeshadow-Bole-Glitter,#79443B,0,,85
EYESHADOW,Eyeshadow-PaleRedViolet-Glitter,#DB7093,0,,85
EYESHADOW,Eyeshadow-OldMauve-Matte,#673147,0,,0
EYESHADOW,Eyeshadow-OldRose-Sheer,#C08081,0,,85
EYESHADOW,Eyeshadow-TealBlue-Sheer,#367588,0,,85
EYESHADOW,Eyeshadow-Silver-Sheer,#C0C0C0,0,,85
EYESHADOW,Eyeshadow-Wine-Sheer,#752731,0,,85
EYESHADOW,Eyeshadow-BlueBell-Matte,#A2A2D0,0,,0
EYESHADOW,Eyeshadow-RuddyPink-Matte,#E18E96,0,,0
EYESHADOW,Eyeshadow-RoseVale-Sheer,#AB4E52,0,,75
EYESHADOW,Eyeshadow-DarkCoral-Sheer,#CD5B45,0,,85
EYESHADOW,Eyeshadow-RubbyBrown-Sheer,#BB6528,0,,85
EYESHADOW,Eyeshadow-Tan-Sheer,#D2B48C,0,,85
EYESHADOW,Eyeshadow-PastelViolet-Sheer,#CB99C9,0,,85
EYESHADOW,Eyeshadow-Puce-Sheer,#CC8899,0,,85
EYESHADOW,Eyeshadow-OrangeYellow-Matte,#EFD05F,0,,0
LIPCOLOR,Lipstick-Lust-Satin,#E62020,50,#eeeeee,50
LIPCOLOR,Lipstick-PaleCarmine-Satin,#AF4035,50,#eeeeee,50
LIPCOLOR,Lipstick-BabyPink-Sheer,#F0BDC2,75,#eeeeee,50
EYESHADOW,Eyeshadow-MediumJungleGreen-Glitter,#214331,0,,85
LIPCOLOR,Lipstick-DarkSalmon-Matte,#E09185,50,#eeeeee,50
LIPCOLOR,Lipstick-PaleChestnut-Satin,#DEA79C,50,#eeeeee,50
EYESHADOW,Eyeshadow-RichMaroon-Glitter,#B03060,0,,85
LIPCOLOR,Lipstick-Tomato-Matte,#FD6649,50,#eeeeee,50
LIPCOLOR,Lipstick-Flame-Matte,#E25822,50,#eeeeee,50
EYESHADOW,Eyeshadow-PurpleTaupe-Matte,#50404D,0,,0
EYESHADOW,Eyeshadow-PaleGold-Sheer,#E6BE8A,0,,85
LIPCOLOR,Lipstick-FuzzyWuzzy-Matte,#CC6666,50,#eeeeee,50
LIPCOLOR,Lipstick-PastelRed-Matte,#FF6961,50,#eeeeee,50
LIPCOLOR,Lipstick-Cherry-Matte,#DE3163,50,#eeeeee,50
EYESHADOW,Eyeshadow-EtonBlue-Glitter,#96C8A2,0,,85
EYESHADOW,Eyeshadow-SkyBlue-Matte,#87CEEB,0,,0
EYESHADOW,Eyeshadow-FuzzyWuzzy-Matte,#BC745D,0,,0
EYESHADOW,Eyeshadow-TaupeGray-Glitter,#929487,0,,85
EYESHADOW,Eyeshadow-IndianYellow-Glitter,#E3A857,0,,85
EYESHADOW,Eyeshadow-PaleCopper-Glitter,#E2946B,0,,85
EYESHADOW,Eyeshadow-TurkishRose-Glitter,#B57281,0,,85
EYESHADOW,Eyeshadow-PalePink-Glitter,#EFD0D6,0,,85
EYESHADOW,Eyeshadow-Ecru-Glitter,#BAA882,0,,80
EYESHADOW,Eyeshadow-Chestnut-Sheer,#CF5861,0,,80
EYESHADOW,Eyeshadow-Tumbleweed-Glitter,#DEAA88,0,,85
EYESHADOW,Eyeshadow-SmokyBlack-Glitter,#000000,0,,85
EYESHADOW,Eyeshadow-PaleChestnut-Sheer,#DDADAF,0,,85
EYESHADOW,Eyeshadow-Brass-Glitter,#B5A642,0,,85
EYESHADOW,Eyeshadow-CharcoalBlue-Glitter,#28395D,0,,75
LIPCOLOR,Lipstick-PaleTerraCotta-Matte,#D16E56,50,#eeeeee,50
LIPCOLOR,Lipstick-TerraCottaPink-Matte,#EB655A,50,#eeeeee,50
LIPCOLOR,Lipstick-MediumCarmine-Matte,#AE4C2B,50,#eeeeee,50
EYESHADOW,Eyeshadow-LapisLazuli-Glitter,#26619C,0,,85
EYESHADOW,Eyeshadow-SkyMagenta-Glitter,#CF71AF,0,,85
EYESHADOW,Eyeshadow-PersianOrange-Glitter,#D99058,0,,85
LIPCOLOR,Lipstick-Cardina-Satin,#C41E3A,50,#eeeeee,50
LIPCOLOR,Lipstick-OldRose-Satin,#C08081,50,#eeeeee,50
LIPCOLOR,Lipstick-DeepChestnut-Satin,#B94E48,50,#eeeeee,50
LIPCOLOR,Lipstick-PastelBrown-Satin,#836953,50,#eeeeee,50
LIPCOLOR,Lipstick-TerraCotta-Satin,#E2725B,50,#eeeeee,50
EYELINER,Eyeliner-DarkCandyAppleRed-Matte,#A40000,0,,0
EYELINER,Eyeliner-Coffee-Matte,#6F4E37,0,,0
EYELINER,Eyeliner-Byzantium-Matte,#702963,0,,0
EYELINER,Eyeliner-PortlandOrange-Matte,#FF5A36,0,,0
EYELINER,Eyeliner-VioletRed-Matte,#F75394,0,,0
EYELINER,Eyeliner-Lilac-Matte,#C8A2C8,0,,0
EYELINER,Eyeliner-Saffron-Matte,#F4C430,0,,0
EYELINER,Eyeliner-DarkPastelBlue-Matte,#779ECB,0,,0
EYESHADOW,Eyeshadow-Snow-Matte,#FFFAFA,0,,0
EYESHADOW,Eyeshadow-RoseGold-Matte,#B76E79,0,,0
EYESHADOW,Eyeshadow-LapisLazuli-Matte,#26619C,0,,0
LIPCOLOR,Lipstick-DebianRed-Satin,#D70A53,50,#eeeeee,50
LIPCOLOR,Lipstick-Lava-Satin,#CF1020,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkPink-Satin,#E75480,50,#eeeeee,50
LIPCOLOR,Lipstick-Chestnut-Satin,#CD5C5C,50,#eeeeee,50
EYESHADOW,Eyeshadow-AuroMetalSaurus-Matte,#6E7F80,0,,0
EYESHADOW,Eyeshadow-CoralPink-Matte,#F88379,0,,0
EYESHADOW,Eyeshadow-RaspberryGlace-Matte,#915F6D,0,,0
EYESHADOW,Eyeshadow-Lilac-Matte,#C8A2C8,0,,0
EYESHADOW,Eyeshadow-Wheat-Matte,#F5DEB3,0,,0
EYESHADOW,Eyeshadow-DeepCoffee-Matte,#704241,0,,0
LIPCOLOR,Lipstick-DeepCarmine-Matte,#A9203E,50,#eeeeee,50
LIPCOLOR,Lipstick-OldRose-Matte,#C08081,50,#eeeeee,50
LIPCOLOR,Lipstick-CopperRose-Matte,#996666,50,#eeeeee,50
EYESHADOW,Eyeshadow-Bole-Matte,#79443B,0,,0
EYESHADOW,Eyeshadow-Gainsboro-Glitter,#DCDCDC,0,,85
EYESHADOW,Eyeshadow-CopperRose-Glitter,#996666,0,,85
EYESHADOW,Eyeshadow-Beaver-Glitter,#9F8170,0,,85
EYESHADOW,Eyeshadow-CarminePink-Matte,#EB4C42,0,,0
EYESHADOW,Eyeshadow-TerraCotta-Matte,#E2725B,0,,0
EYESHADOW,Eyeshadow-Pearl-Matte,#EAE0C8,0,,0
EYESHADOW,Eyeshadow-TerraCotta-Sheer,#E2725B,0,,50
LIPCOLOR,Lipstick-Sinopia-Matte,#CB410B,50,#eeeeee,50
LIPCOLOR,Lipstick-CornellRed-Matte,#B31B1B,50,#eeeeee,50
LIPCOLOR,Lipstick-LightBrown-Matte,#B5651D,50,#eeeeee,50
LIPCOLOR,Lipstick-FireEngineRed-Matte,#CE2029,50,#eeeeee,50
LIPCOLOR,Lipstick-SunsetOrange-Matte,#FD5E53,50,#eeeeee,50
EYELINER,Eyeliner-Umber-Matte,#635147,0,,0
EYELINER,Eyeliner-PastelBrown-Matte,#836953,0,,0
LIPCOLOR,Lipstick-RaspberryRose-Satin,#B3446C,50,#eeeeee,50
LIPCOLOR,Lipstick-LightCarminePink-Satin,#E66771,50,#eeeeee,50
LIPCOLOR,Lipstick-LightThulianPink-Satin,#E68FAC,50,#eeeeee,50
LIPCOLOR,Lipstick-Blush-Satin,#DE5D83,50,#eeeeee,50
LIPCOLOR,Lipstick-Tumbleweed-Satin,#DEAA88,50,#eeeeee,50
LIPCOLOR,Lipstick-PaleCopper-Sheer,#DA8A67,55,#eeeeee,50
EYESHADOW,Eyeshadow-Black-Matte,#000000,0,,0
EYESHADOW,Eyeshadow-Coffee-Matte,#6F4E37,0,,0
EYESHADOW,Eyeshadow-DarkChestnut-Matte,#986960,0,,0
EYESHADOW,Eyeshadow-OldLavender-Matte,#796878,0,,0
LIPCOLOR,Lipstick-DesertSand-Satin,#EDC9AF,50,#eeeeee,50
LIPCOLOR,Lipstick-VividTangerine-Satin,#FFA089,50,#eeeeee,50
LIPCOLOR,Lipstick-CaputMortuum-Satin,#592720,50,#eeeeee,50
LIPCOLOR,Lipstick-PortlandOrange-Satin,#FF5A36,50,#eeeeee,50
LIPCOLOR,Lipstick-DogwoodRose-Satin,#D71868,50,#eeeeee,50
LIPCOLOR,Lipstick-CarminePink-Satin,#EB4C42,50,#eeeeee,50
LIPCOLOR,Lipstick-PurpleMountainMajesty-Matte,#9678B6,50,#eeeeee,50
LIPCOLOR,Lipstick-PansyPurple-Matte,#78184A,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkRaspberry-Matte,#872657,50,#eeeeee,50
LIPCOLOR,Lipstick-RaspberryRose-Matte,#B3446C,50,#eeeeee,50
LIPCOLOR,Lipstick-Blush-Matte,#DE5D83,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkScarlet-Matte,#5c0b23,50,#eeeeee,50
LIPCOLOR,Lipstick-Lava-Matte,#CF1020,50,#eeeeee,50
LIPCOLOR,Lipstick-Sienna-Matte,#882D17,50,#eeeeee,50
LIPCOLOR,Lipstick-Bole-Matte,#79443B,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkChestnut-Matte,#986960,50,#eeeeee,50
LIPCOLOR,Lipstick-Bronze-Matte,#CD7F32,50,#eeeeee,50
LIPCOLOR,Lipstick-FaluRed-Matte,#801818,50,#eeeeee,50
LIPCOLOR,Lipstick-Wine-Matte,#722F37,50,#eeeeee,50
LIPCOLOR,Lipstick-Amaranth-Matte,#E52B50,50,#eeeeee,50
EYESHADOW,Eyeshadow-Isabelline-Sheer,#F4F0EC,0,,50
EYESHADOW,Eyeshadow-PurpleTaupe-Glitter,#50404D,0,,65
EYESHADOW,Eyeshadow-Almond-Matte,#EFDECD,0,,0
EYESHADOW,Eyeshadow-PersianOrange-Matte,#D99058,0,,0
EYESHADOW,Eyeshadow-BurntUmber-Matte,#8A3324,0,,0
EYESHADOW,Eyeshadow-SunsetOrange-Matte,#FD5E53,0,,0
EYESHADOW,Eyeshadow-TealBlue-Matte,#367588,0,,0
EYESHADOW,Eyeshadow-Chamoisee-Matte,#A0785A,0,,0
EYESHADOW,Eyeshadow-Cadet-Matte,#536872,0,,0
EYESHADOW,Eyeshadow-Umber-Matte,#635147,0,,0
EYESHADOW,Eyeshadow-PalatinatePurple-Matte,#4D135C,0,,0
EYESHADOW,Eyeshadow-DimGray-Matte,#635B56,0,,0
EYESHADOW,Eyeshadow-PastelGray-Matte,#CFCFC4,0,,0
EYESHADOW,Eyeshadow-Shadow-Matte,#8A795D,0,,0
EYESHADOW,Eyeshadow-LightSlateGray-Matte,#778899,0,,0
EYESHADOW,Eyeshadow-CadetGrey-Matte,#91A3B0,0,,0
EYESHADOW,Eyeshadow-AshGrey-Matte,#B2BEB5,0,,0
EYESHADOW,Eyeshadow-RoseEbony-Matte,#674846,0,,0
EYESHADOW,Eyeshadow-PastelBrown-Matte,#836953,0,,0
EYESHADOW,Eyeshadow-PastelBrown-Sheer,#836953,0,,85
EYESHADOW,Eyeshadow-MediumTaupe-Sheer,#674C47,0,,85
EYESHADOW,Eyeshadow-Chamoisee-Glitter,#A0785A,0,,85
EYESHADOW,Eyeshadow-CafeAuLait-Sheer,#A67B5B,0,,85
EYESHADOW,Eyeshadow-PaleBrown-Sheer,#987654,0,,65
EYESHADOW,Eyeshadow-DarkLava-Sheer,#483C32,0,,50
EYESHADOW,Eyeshadow-Olivine-Sheer,#9AB973,0,,65
EYESHADOW,Eyeshadow-Khaki-Sheer,#C3B091,0,,85
EYESHADOW,Eyeshadow-AntiqueBrass-Sheer,#CD9575,0,,85
EYESHADOW,Eyeshadow-Timberwolf-Sheer,#DBD7D2,0,,50
EYESHADOW,Eyeshadow-HookerGreen-Matte,#49796B,0,,0
EYESHADOW,Eyeshadow-LightTaupe-Sheer,#B38B6D,0,,85
EYESHADOW,Eyeshadow-Cardinal-Matte,#CC233D,0,,0
EYESHADOW,Eyeshadow-Viridian-Matte,#40826D,0,,0
EYESHADOW,Eyeshadow-PearlAqua-Matte,#88D8C0,0,,0
EYESHADOW,Eyeshadow-GrannySmithApple-Matte,#A8E4A0,0,,0
EYESHADOW,Eyeshadow-DarkSlateGray-Matte,#2F4F4F,0,,0
EYESHADOW,Eyeshadow-PurpleMountainMajesty-Matte,#9678B6,0,,0
EYESHADOW,Eyeshadow-Cherry-Matte,#DE3163,0,,0
EYESHADOW,Eyeshadow-MacaroniandCheese-Matte,#FFBD88,0,,0
EYESHADOW,Eyeshadow-BurntSienna-Matte,#E97451,0,,0
EYESHADOW,Eyeshadow-PastelOrange-Matte,#FFB347,0,,0
EYESHADOW,Eyeshadow-Corn-Matte,#FBEC5D,0,,0
EYESHADOW,Eyeshadow-Wine-Matte,#722F37,0,,0
EYESHADOW,Eyeshadow-Mulberry-Matte,#C54B8C,0,,0
EYESHADOW,Eyeshadow-DavyGrey-Matte,#555555,0,,0
EYESHADOW,Eyeshadow-VividTangerine-Sheer,#FFA089,0,,85
EYESHADOW,Eyeshadow-Bronze-Sheer,#CD7F32,0,,85
EYESHADOW,Eyeshadow-LightTaupe-Matte,#B38B6D,0,,0
EYESHADOW,Eyeshadow-Lion-Sheer,#C19A6B,0,,65
EYESHADOW,Eyeshadow-Munsell-Sheer,#F2F3F4,0,,85
EYESHADOW,Eyeshadow-MossGreen-Matte,#ADDFAD,0,,0
EYESHADOW,Eyeshadow-RoyalPurple-Matte,#7851A9,0,,0
EYESHADOW,Eyeshadow-Charcoal-Matte,#36454F,0,,0
EYESHADOW,Eyeshadow-CamouflageGreen-Matte,#78866B,0,,0
EYESHADOW,Eyeshadow-Tan-Matte,#D2B48C,0,,0
EYELINER,Eyeliner-OuterSpace-Matte,#414A4C,0,,0
EYELINER,Eyeliner-DarkByzantium-Matte,#5D3954,0,,0
EYELINER,Eyeliner-MSUGreen-Matte,#18453B,0,,0
EYELINER,Eyeliner-UCLABlue-Matte,#536895,0,,0
EYELINER,Eyeliner-Rackley-Matte,#5D8AA8,0,,0
EYELINER,Eyeliner-MoonstoneBlue-Matte,#73A9C2,0,,0
EYELINER,Eyeliner-CadetGrey-Matte,#91A3B0,0,,0
EYELINER,Eyeliner-Bone-Matte,#E3DAC9,0,,0
LIPCOLOR,Lipstick-HalayaUbe-Matte,#663854,50,#eeeeee,50
LIPCOLOR,Lipstick-Tumbleweed-Matte,#DEAA88,50,#eeeeee,50
LIPCOLOR,Lipstick-LightSalmon-Shimmer,#FFA07A,30,#E5AA70,70
LIPCOLOR,Lipstick-BabyPink-Shimmer,#F4C2C2,30,#E5AA70,75
LIPCOLOR,Lipstick-DeepCoffee-Shimmer,#704241,30,#E5AA70,75
LIPCOLOR,Lipstick-VividBurgundy-Shimmer,#78184A,25,#E5AA70,70
EYESHADOW,Eyeshadow-WildBlueYonder-Sheer,#A2ADD0,0,,85
EYESHADOW,Eyeshadow-RoseTaupe-Matte,#936351,0,,0
EYESHADOW,Eyeshadow-Grullo-Matte,#A99A86,0,,0
EYESHADOW,Eyeshadow-DarkLava-Matte,#483C32,0,,0
EYESHADOW,Eyeshadow-Eggshell-Matte,#F0EAD6,0,,0
EYESHADOW,Eyeshadow-DarkTan-Matte,#918151,0,,0
EYESHADOW,Eyeshadow-Puce-Matte,#CC8899,0,,0
EYESHADOW,Eyeshadow-MediumTaupe-Matte,#674C47,0,,0
EYESHADOW,Eyeshadow-CaputMortuum-Matte,#592720,0,,0
EYESHADOW,Eyeshadow-Bistre-Matte,#3D2B1F,0,,0
EYESHADOW,Eyeshadow-PaleTaupe-Matte,#BC987E,0,,0
EYESHADOW,Eyeshadow-CamouflageGreen-Glitter,#78866B,0,,85
EYESHADOW,Eyeshadow-PaleChestnut-Matte,#DDADAF,0,,0
EYESHADOW,Eyeshadow-PaleSilver-Matte,#C9C0BB,0,,0
EYESHADOW,Eyeshadow-Khaki-Matte,#C3B091,0,,0
EYESHADOW,Eyeshadow-SaintPatrickBlue-Matte,#23297A,0,,0
EYESHADOW,Eyeshadow-Fern-Sheer,#71BC78,0,,65
EYESHADOW,Eyeshadow-PayneGrey-Matte,#536878,0,,0
EYESHADOW,Eyeshadow-IndianYellow-Matte,#E3A857,0,,0
EYESHADOW,Eyeshadow-PaleCarmine-Glitter,#AF4035,0,,85
EYESHADOW,Eyeshadow-Fawn-Glitter,#E5AA70,0,,95
LIPCOLOR,Lipstick-Lust-Matte,#E62020,50,#eeeeee,50
LIPCOLOR,Lipstick-Cordovan-Matte,#893F45,50,#eeeeee,50
LIPCOLOR,Lipstick-BurntUmber-Matte,#8A3324,50,#eeeeee,50
LIPCOLOR,Lipstick-TurkishRose-Matte,#B57281,50,#eeeeee,50
LIPCOLOR,Lipstick-VividTangerine-Matte,#FFA089,50,#eeeeee,50
LIPCOLOR,Lipstick-Burgundy-Matte,#800020,50,#eeeeee,50
LIPCOLOR,Lipstick-LightSalmon-Matte,#FFA07A,50,#eeeeee,50
LIPCOLOR,Lipstick-Puce-Matte,#CC8899,50,#eeeeee,50
EYELINER,Eyeliner-Wine-Matte,#722F37,0,,0
EYELINER,Eyeliner-PaleGold-Matte,#E6BE8A,0,,0
EYELINER,Eyeliner-DavyGrey-Matte,#555555,0,,0
EYELINER,Eyeliner-Bistre-Matte,#3D2B1F,0,,0
EYELINER,Eyeliner-CaputMortuum-Matte,#592720,0,,0
EYELINER,Eyeliner-RifleGreen-Matte,#414833,0,,0
EYELINER,Eyeliner-DarkSlateGray-Matte,#2F4F4F,0,,0
EYELINER,Eyeliner-Shamrock-Matte,#45CEA2,0,,0
EYELINER,Eyeliner-MediumTurquoise-Matte,#48D1CC,0,,0
EYELINER,Eyeliner-CeruleanBlue-Matte,#2A52BE,0,,0
EYELINER,Eyeliner-MidnightBlue-Matte,#191970,0,,0
EYELINER,Eyeliner-PalatinatePurple-Matte,#682860,0,,0
EYELINER,Eyeliner-Cordovan-Matte,#893F45,0,,0
EYELINER,Eyeliner-Mauvelous-Matte,#EF98AA,0,,0
EYELINER,Eyeliner-DarkPink-Matte,#E75480,0,,0
EYELINER,Eyeliner-Bisque-Matte,#FFE4C4,0,,0
EYESHADOW,Eyeshadow-DavyGrey-Sheer,#555555,0,,35
EYESHADOW,Eyeshadow-TaupeGray-Matte,#8B8589,0,,0
EYESHADOW,Eyeshadow-Verdigris-Matte,#43B3AE,0,,0
EYESHADOW,Eyeshadow-Wenge-Matte,#645452,0,,0
EYESHADOW,Eyeshadow-BrinkPink-Matte,#FB607F,0,,0
EYESHADOW,Eyeshadow-PaleCarmine-Matte,#AF4035,0,,0
EYESHADOW,Eyeshadow-SandyBrown-Matte,#F4A460,0,,0
EYESHADOW,Eyeshadow-TurkishRose-Matte,#B57281,0,,0
EYESHADOW,Eyeshadow-LightSalmonPink-Matte,#FF9999,0,,0
EYESHADOW,Eyeshadow-Bisque-Matte,#FFE4C4,0,,0
EYESHADOW,Eyeshadow-Beaver-Matte,#9F8170,0,,0
EYESHADOW,Eyeshadow-CandyPink-Matte,#E4717A,0,,0
LIPCOLOR,Lipstick-RoseVale-Satin,#AB4E52,50,#eeeeee,50
LIPCOLOR,Lipstick-CerisePink-Satin,#EC3B83,50,#eeeeee,50
LIPCOLOR,Lipstick-RichMaroon-Satin,#B03060,50,#eeeeee,50
LIPCOLOR,Lipstick-RoseMadder-Satin,#E32636,50,#eeeeee,50
LIPCOLOR,Lipstick-CandyPink-Satin,#E4717A,50,#eeeeee,50
LIPCOLOR,Lipstick-AntiqueBrass-Matte,#CD9575,50,#eeeeee,50
LIPCOLOR,Lipstick-Onyx-Matte,#0F0F0F,50,#eeeeee,50
LIPCOLOR,Lipstick-RifleGreen-Matte,#414833,50,#eeeeee,50
LIPCOLOR,Lipstick-Charcoal-Matte,#36454F,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkCerulean-Matte,#08457E,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkLava-Matte,#483C32,50,#eeeeee,50
LIPCOLOR,Lipstick-BrightMaroon-Matte,#C32148,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkCandyAppleRed-Matte,#A40000,50,#eeeeee,50
LIPCOLOR,Lipstick-PersianPlum-Matte,#701C1C,50,#eeeeee,50
LIPCOLOR,Lipstick-CaputMortuum-Matte,#592720,50,#eeeeee,50
LIPCOLOR,Lipstick-DeepCoffee-Matte,#704241,50,#eeeeee,50
LIPCOLOR,Lipstick-CafeAuLait-Matte,#A67B5B,50,#eeeeee,50
LIPCOLOR,Lipstick-UpsdellRed-Matte,#AE2029,50,#eeeeee,50
LIPCOLOR,Lipstick-Jasper-Matte,#D73B3E,50,#eeeeee,50
LIPCOLOR,Lipstick-Chestnut-Matte,#CD5C5C,50,#eeeeee,50
EYESHADOW,Eyeshadow-Bistre-Glitter,#3D2B1F,0,,85
EYESHADOW,Eyeshadow-DarkLava-Glitter,#483C32,0,,85
EYESHADOW,Eyeshadow-DarkSlateBlue-Glitter,#483D8B,0,,95
EYESHADOW,Eyeshadow-LavenderGray-Glitter,#C4C3D0,0,,85
EYESHADOW,Eyeshadow-PaleTaupe-Glitter,#BC987E,0,,85
EYESHADOW,Eyeshadow-DesertSand-Glitter,#EDC9AF,0,,85
EYESHADOW,Eyeshadow-HanBlue-Glitter,#446CCF,0,,85
EYESHADOW,Eyeshadow-MediumTurquoise-Glitter,#48D1CC,0,,85
LIPCOLOR,Lipstick-DarkSienna-Matte,#3C1414,50,#eeeeee,50
LIPCOLOR,Lipstick-RoseGold-Satin,#B76E79,75,#eeeeee,50
LIPCOLOR,Lipstick-CopperRose-Satin,#996666,75,#eeeeee,50
LIPCOLOR,Lipstick-Wine-Satin,#722F37,75,#eeeeee,50
LIPCOLOR,Lipstick-PersianPlum-Satin,#701C1C,85,#eeeeee,50
LIPCOLOR,Lipstick-FireEngineRed-Satin,#CE2029,85,#eeeeee,50
LIPCOLOR,Lipstick-FuzzyWuzzy-Sheer,#CC6666,75,#cc6666,75
LIPCOLOR,Lipstick-CoralPink-Sheer,#F88379,75,#cd5015,75
LIPCOLOR,Lipstick-TurkishRose-Sheer,#B57281,75,#800080,75
LIPCOLOR,Lipstick-TickleMePink-Sheer,#FC89AC,75,#eeeeee,75
LIPCOLOR,Lipstick-Awesome-Sheer,#FF2052,75,#bdeeee,75
EYELINER,Eyeliner-White-Matte,#ffffff,0,,0
EYELINER,Eyeliner-Sunglow-Matte,#FFCC33,0,,0
EYELINER,Eyeliner-LightCrimson-Matte,#F56991,0,,0
EYELINER,Eyeliner-BrightTurquoise-Matte,#08E8DE,0,,0
EYELINER,Eyeliner-MangoTango-Matte,#FF8243,0,,0
EYELINER,Eyeliner-BlueViolet-Matte,#8A2BE2,0,,0
EYELINER,Eyeliner-MediumTealBlue-Matte,#0054B4,0,,0
EYELINER,Eyeliner-JazzberryJam-Matte,#A50B5E,0,,0
EYELINER,Eyeliner-DarkTan-Matte,#918151,0,,0
EYELINER,Eyeliner-Copper-Matte,#B87333,0,,0
EYELINER,Eyeliner-DarkLava-Matte,#483C32,0,,0
EYELINER,Eyeliner-Bazaar-Matte,#98777B,0,,0
LIPCOLOR,Lipstick-FuzzyWuzzy-Satin,#CC6666,50,#eeeeee,50
LIPCOLOR,Lipstick-SkyMagenta-Satin,#CF71AF,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkCoral-Satin,#CD5B45,50,#eeeeee,50
EYESHADOW,Eyeshadow-ArylideYellow-Matte,#E9D66B,0,,0
EYESHADOW,Eyeshadow-SkyMagenta-Matte,#CF71AF,0,,0
EYESHADOW,Eyeshadow-PersianPlum-Matte,#701C1C,0,,0
LIPCOLOR,Lipstick-Sandstorm-Sheer,#ECD540,75,#eeeeee,50
LIPCOLOR,Lipstick-SafetyOrange-Sheer,#FF6700,75,#eeeeee,50
LIPCOLOR,Lipstick-SunsetOrange-Sheer,#FD5E53,75,#eeeeee,50
LIPCOLOR,Lipstick-TwilightLavender-Sheer,#8A496B,75,#eeeeee,50
LIPCOLOR,Lipstick-Lust-Sheer,#E62020,75,#eeeeee,50
LIPCOLOR,Lipstick-BrilliantRose-Satin,#FF55A3,75,#eeeeee,50
LIPCOLOR,Lipstick-TyrianPurple-Satin,#66023C,75,#eeeeee,50
LIPCOLOR,Lipstick-Burgundy-Satin,#800020,75,#eeeeee,50
LIPCOLOR,Lipstick-Amaranth-Satin,#E52B50,75,#eeeeee,50
LIPCOLOR,Lipstick-CrimsonGlory-Sheer,#BE0032,65,#eeeeee,50
LIPCOLOR,Lipstick-RoseVale-Sheer,#AB4E52,65,#eeeeee,50
LIPCOLOR,Lipstick-LightSalmonPink-Satin,#FF9999,85,#eeeeee,50
LIPCOLOR,Lipstick-FlamingoPink-Satin,#FC8EAC,85,#eeeeee,50
LIPCOLOR,Lipstick-RadicalRed-Satin,#FF355E,85,#eeeeee,50
LIPCOLOR,Lipstick-DeepCarminePink-Satin,#EF3038,85,#eeeeee,50
EYESHADOW,Eyeshadow-CarolinaBlue-Matte,#99BADD,0,,0
EYESHADOW,Eyeshadow-DarkJungleGreen-Matte,#1A2421,0,,0
EYESHADOW,Eyeshadow-BattleshipGrey-Matte,#848482,0,,0
EYESHADOW,Eyeshadow-CafeAuLait-Matte,#A67B5B,0,,0
EYESHADOW,Eyeshadow-RosyBrown-Matte,#BC8F8F,0,,0
EYESHADOW,Eyeshadow-AntiqueBrass-Matte,#CD9575,0,,0
EYESHADOW,Eyeshadow-AntiqueFuchsia-Matte,#915C83,0,,0
EYESHADOW,Eyeshadow-PastelViolet-Matte,#CB99C9,0,,0
EYESHADOW,Eyeshadow-DarkSeaGreen-Matte,#8FBC8F,0,,0
EYESHADOW,Eyeshadow-Ecru-Matte,#C2B280,0,,0
EYESHADOW,Eyeshadow-PaleBrown-Matte,#987654,0,,0
LIPCOLOR,Lipstick-Cardina-Matte,#C41E3A,50,#eeeeee,50
LIPCOLOR,Lipstick-RoseVale-Matte,#AB4E52,50,#eeeeee,50
LIPCOLOR,Lipstick-BrickRed-Matte,#CB4154,50,#eeeeee,50
LIPCOLOR,Lipstick-DeepChestnut-Matte,#B94E48,50,#eeeeee,50
LIPCOLOR,Lipstick-CarminePink-Matte,#EB4C42,50,#eeeeee,50
LIPCOLOR,Lipstick-Firebrick-Matte,#B22222,50,#eeeeee,50
LIPCOLOR,Lipstick-VividBurgundy-Satin,#9F1D35,50,#eeeeee,50
LIPCOLOR,Lipstick-Jasper-Satin,#D73B3E,50,#eeeeee,50
LIPCOLOR,Lipstick-BrickRed-Satin,#CB4154,50,#eeeeee,50
LIPCOLOR,Lipstick-KUCrimson-Satin,#E8000D,50,#eeeeee,50
EYELINER,Eyeliner-PersianPlum-Matte,#701C1C,0,,0
EYELINER,Eyeliner-CafeNoir-Matte,#4B3621,0,,0
EYELINER,Eyeliner-Tan-Matte,#D2B48C,0,,0
EYELINER,Eyeliner-DimGray-Matte,#696969,0,,0
EYELINER,Eyeliner-RoseEbony-Matte,#674846,0,,0
EYELINER,Eyeliner-CafeAuLait-Matte,#A67B5B,0,,0
EYELINER,Eyeliner-LightTaupe-Matte,#B38B6D,0,,0
EYELINER,Eyeliner-DesertSand-Matte,#EDC9AF,0,,0
EYELINER,Eyeliner-Shadow-Matte,#8A795D,0,,0
EYELINER,Eyeliner-Black-Matte,#000000,0,,0
EYESHADOW,Eyeshadow-OldRose-Matte,#C08081,0,,0
EYESHADOW,Eyeshadow-DeepChestnut-Matte,#B94E48,0,,0
EYESHADOW,Eyeshadow-Cordovan-Matte,#893F45,0,,0
EYESHADOW,Eyeshadow-FuzzyWuzzy-Glitter,#CC6666,0,,85
EYESHADOW,Eyeshadow-Tomato-Matte,#FF6347,0,,0
EYESHADOW,Eyeshadow-Firebrick-Sheer,#B22222,0,,85
EYESHADOW,Eyeshadow-RoseVale-Matte,#AB4E52,0,,0
LIPCOLOR,Lipstick-LightCoral-Matte,#F08080,50,#eeeeee,50
LIPCOLOR,Lipstick-RoseGold-Matte,#B76E79,50,#eeeeee,50
LIPCOLOR,Lipstick-BurntSienna-Matte,#E97451,50,#eeeeee,50
LIPCOLOR,Lipstick-PaleRedViolet-Matte,#DB7093,50,#eeeeee,50
LIPCOLOR,Lipstick-RuddyPink-Matte,#E18E96,50,#eeeeee,50
LIPCOLOR,Lipstick-LightCarminePink-Matte,#E66771,50,#eeeeee,50
LIPCOLOR,Lipstick-CandyPink-Matte,#E4717A,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkCoral-Matte,#CD5B45,50,#eeeeee,50
LIPCOLOR,Lipstick-TerraCotta-Matte,#E2725B,50,#eeeeee,50
LIPCOLOR,Lipstick-Flame-Glitter,#E25822,50,#edb234,75
LIPCOLOR,Lipstick-RedBrown-Matte,#A52A2A,50,#eeeeee,50
LIPCOLOR,Lipstick-Rust-Matte,#B7410E,50,#eeeeee,50
LIPCOLOR,Lipstick-SmokeyTopaz-Matte,#933D41,50,#eeeeee,50
LIPCOLOR,Lipstick-VividBurgundy-Matte,#9F1D35,50,#eeeeee,50
LIPCOLOR,Lipstick-DarkTerraCotta-Matte,#CC4E5C,50,#eeeeee,50
LIPCOLOR,Lipstick-VividAuburn-Matte,#922724,50,#eeeeee,50
LIPCOLOR,Lipstick-PaleCarmine-Matte,#AF4035,50,#eeeeee,50
LIPCOLOR,Lipstick-UpMaroon-Matte,#7B1113,50,#eeeeee,50
EYESHADOW,Eyeshadow-CafeNoir-Matte,#4B3621,0,,0
EYESHADOW,Eyeshadow-Tumbleweed-Matte,#DEAA88,0,,0
EYESHADOW,Eyeshadow-RawSienna-Matte,#D68A59,0,,0
EYESHADOW,Eyeshadow-DesertSand-Matte,#EDC9AF,0,,0
EYESHADOW,Eyeshadow-PaleCopper-Matte,#DA8A67,0,,0
EYESHADOW,Eyeshadow-SmokeyTopaz-Matte,#933D41,0,,0
EYESHADOW,Eyeshadow-BabyPink-Matte,#F4C2C2,0,,0
EYESHADOW,Eyeshadow-DarkSalmon-Matte,#E9967A,0,,0
EYESHADOW,Eyeshadow-PeachPuff-Matte,#FFDAB9,0,,0
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -17,71 +17,169 @@ ...@@ -17,71 +17,169 @@
display: inline-block; display: inline-block;
padding: 2px 4px 0; padding: 2px 4px 0;
} }
.products { .products {
margin: 2px 8px; margin: 2px 8px;
font-family: 'Poppins', 'Montserrat', 'Lato', 'Roboto', 'Quicksand', sans-serif; font-family: 'Poppins', 'Montserrat', 'Lato', 'Roboto', 'Quicksand', sans-serif;
font-size: 14px; font-size: 14px;
} }
.product { .product {
margin: 4px 0; margin: 4px 0;
} }
.variant { .variant {
width: 24px; width: 24px;
height: 24px; height: 24px;
display: inline-block; display: inline-block;
border-radius: 8px; border-radius: 8px;
border: 1px solid #6b6a6a; border: 1px solid #6b6a6a;
box-shadow: inset #fff1f1 0px 3px 8px 1px;
margin: 0 2px 0 0; margin: 0 2px 0 0;
transition: all 0.3s ease-in; transition: all 0.3s ease-in;
} }
.info .variant { .info .variant {
height: 80px; height: 80px;
min-width: 80px; min-width: 80px;
} }
.variant.selected { .variant.selected {
box-shadow: #5f5353 0px 0px 8px 2px; box-shadow: #5f5353 0px 0px 8px 2px;
border-color: #b5b5b5; border-color: #b5b5b5;
} }
.variants { .variants {
margin: 4px 0 8px; margin: 4px 0 8px;
cursor: pointer cursor: pointer
} }
.collection.expanded .products { .collection.expanded .products {
display: none; display: none;
} }
.collection-title:before { .collection-title:before {
content: '–'; content: '–';
margin: 0 2px 0 0; margin: 0 2px 0 0;
} }
.collection-title { .collection-title {
cursor: pointer; cursor: pointer;
} }
.expanded .collection-title:before{
.expanded .collection-title:before {
content: '+'; content: '+';
margin: 0 2px 0 0; margin: 0 2px 0 0;
} }
.info-line { .info-line {
display: flex; display: flex;
} }
.very-info { .very-info {
margin: 4px 8px; margin: 4px 8px;
width: 100%;
} }
.info-title { .info-title {
font-size: 18px; font-size: 24px;
margin: 32px 2px 8px; margin: 32px 2px 8px;
} }
.info { .info {
font-family: 'Poppins', 'Montserrat', 'Lato', 'Roboto', 'Quicksand', sans-serif; font-family: 'Poppins', 'Montserrat', 'Lato', 'Roboto', 'Quicksand', sans-serif;
} }
.info-img { .info-img {
width: 80px; width: 80px;
} }
input.field__input { input.field__input {
left: 0; left: 0;
height: 32px; height: 32px;
position: relative; position: relative;
padding: 4px; padding: 4px;
width: calc(100% - 16px);
box-sizing: border-box;
margin: 0 4px;
}
.preview {
min-width: 96px;
}
span.color-span {
background: #fff;
padding: 4px 8px;
border-radius: 4px;
}
.color {
padding: 8px;
border-radius: 4px;
}
.info-description {
padding: 16px 0 0 16px;
}
span.prop:after {
content: ':';
}
span.prop {
color: #999;
padding: 0 8px 0 0;
font-size: 12px;
}
.categories {
position: absolute;
overflow-y: auto;
right: 12px;
left: 4px;
}
#content-panel {
width: 100%;
position: relative;
}
.variant.variant-hidden {
display: none;
}
.product.product-hidden {
display: none;
}
.collection.hidden {
display: none;
}
.product-counter {
padding-left: 10px;
color: #999;
}
.cross.hidden {
display: none;
}
.cross {
position: absolute;
z-index: 3;
right: 12px;
top: 0px;
font-family: monospace;
padding: 8px 10px;
cursor: pointer;
}
.field {
margin-right: 16px;
}
.block.hidden {
display: none;
} }
</style> </style>
</head> </head>
...@@ -89,112 +187,262 @@ ...@@ -89,112 +187,262 @@
<script> <script>
const API_KEY = "SMB-Ojo6MjU1NDU="; const API_KEY = "SMB-Ojo6MjU1NDU=";
(function (d, k) { ( function( d, k ){
var s = d.createElement('script'); var s = d.createElement( 'script' );
s.type = 'text/javascript'; s.type = 'text/javascript';
s.async = true; s.async = true;
s.src = 'https://plugins-media.perfectcorp.com/smb/sdk.js?apiKey=' + k; s.src = 'https://plugins-media.perfectcorp.com/smb/sdk.js?apiKey=' + k;
var x = d.getElementsByTagName('script')[0]; var x = d.getElementsByTagName( 'script' )[ 0 ];
x.parentNode.insertBefore(s, x); x.parentNode.insertBefore( s, x );
})(document, API_KEY); } )( document, API_KEY );
</script> </script>
<script> <script>
let YMK_close = document.getElementById('YMK-close'); const slice = [].slice;
const Component = function( cfg ){
var original = cfg;
var _ctor = function( cfg, children ){
if( !( this instanceof _ctor ) ){
return new _ctor( cfg, children );
}
this.store = new Store();
this._apply( cfg );
arguments.length > 1 && this._children.call( this, slice.call( arguments, 1 ) );
this.__un = new D.Unsubscribe();
original.ctor && original.ctor.apply( this );
};
_ctor.prototype = Object.assign( Object.create( Component.prototype ), cfg );
_ctor.constructor = _ctor;
return _ctor;
};
Component.prototype = {
prop: {},
_children: function( children ){
this.children = children;
},
_apply: function( cfg ){
var prop = this.prop;
for( var key in cfg ){
var val = cfg[ key ];
if( key in prop ){
if( val instanceof Store.StoreBinding || val instanceof Store.HookPrototype ){
this[ key ] = val;
}else{
this[ key ] = new Store.Value[ prop[ key ].type.name ]( val );
}
}else{
this[ key ] = val;
}
}
for( key in prop ){
if( !( key in cfg ) ){
var property = prop[ key ];
if( !property.optional ){
this[ key ] = new Store.Value[ property.type.name ]();
if( property.default ){
this[ key ].set( property.default );
}
}
}
}
},
'~destroy': function(){
var pointer = this.dom.parentNode;
if( !pointer ){
pointer = this.dom;
}
var allHooked = [].slice.call( pointer.querySelectorAll( '[data-hooked]' ) );
for( var i = 0, _i = allHooked.length; i < _i; i++ ){
var un = allHooked[ i ].__un;
if( !un )
continue;
var uns = allHooked[ i ].__un;
for( var j = 0, _j = uns.length; j < _j; j++ ){
var unSubscribe = uns[ j ];
unSubscribe();
}
delete allHooked[ i ].__un;
}
if( this.dom.parentNode ){
pointer.removeChild( this.dom );
}
this.dom = void 0;
this.__un.un();
for( var key in this )
this.hasOwnProperty( key ) && delete this[ key ];
},
sub: function(){
var un = this.store.sub.apply( this.store, arguments );
this.__un.add( un );
}
};
var Property = function( type ){
this.name = type;
};
Property.prototype = {
set: function( val ){
return val;
},
get: function( val ){
return val;
},
compare: function( val1, val2 ){
return val1 === val2;
}
};
Component.Property = {
Any: new Property( 'Any' )
};
var Radio = new Component( {
ctor: function(){
this.createDOM();
this.initBinding();
this.afterInit && this.afterInit();
},
prop: {
value: { type: Component.Property.Any, default: false },
group: { type: Component.Property.Any, default: false }
},
createDOM: function(){
var val = this.value,
group = this.group,
el = this.dom = this.inputEl = D.h( 'input', {
attr: { type: 'radio' },
cls: 'picker-button__field',
onchange: function(){
if( el.checked ){
group.set( val.get() )
}
}
} );
this.afterDOM && this.afterDOM();
},
initBinding: function(){
var _self = this;
this.sub( [ this.value, this.group ], function( val, group ){
_self.inputEl.checked = val === group;
} );
}
} );
let YMK_close = document.getElementById( 'YMK-close' );
let later = void 0; let later = void 0;
function openTryOnTool() {
function openTryOnTool(){
// If the product tags contain "Eyeshadow Palette", shows color swatches button, and make color swatches clickable. // If the product tags contain "Eyeshadow Palette", shows color swatches button, and make color swatches clickable.
let variant_div = document.getElementsByClassName("variant-input"); let variant_div = document.getElementsByClassName( "variant-input" );
// Perfect Module // Perfect Module
// if YMK is not inited - pass this problem to the future // if YMK is not inited - pass this problem to the future
if(!window.YMK || typeof YMK.open !== 'function'){ if( !window.YMK || typeof YMK.open !== 'function' ){
clearTimeout(later); clearTimeout( later );
return later = setTimeout(openTryOnTool, 300); return later = setTimeout( openTryOnTool, 300 );
}else{ }else{
if(!YMK.autoShow){ if( !YMK.autoShow ){
YMK.autoShow = true; YMK.autoShow = true;
YMK.addEventListener('loaded', function(){console.log('after YMK loaded'); YMK.addEventListener( 'loaded', function(){
console.log( 'after YMK loaded' );
// set current active variant // set current active variant
YMK.applyMakeupBySku(document.querySelector('.variant-input-wrap input:checked').parentNode.getAttribute('perfect_sku_id')); YMK.applyMakeupBySku( document.querySelector( '.variant-input-wrap input:checked' ).parentNode.getAttribute( 'perfect_sku_id' ) );
}); } );
} }
} }
YMK.open() YMK.open()
let YMK_module = document.getElementById('YMK-module'); let YMK_module = document.getElementById( 'YMK-module' );
const YMK_SCREEN = "ymk-screen" const YMK_SCREEN = "ymk-screen"
if (YMK.open()) { if( YMK.open() ){
YMK_module.classList.add(YMK_SCREEN) YMK_module.classList.add( YMK_SCREEN )
//YMK_close.style.color = "black"; //YMK_close.style.color = "black";
} else { }else{
YMK_module.classList.remove(YMK_SCREEN) YMK_module.classList.remove( YMK_SCREEN )
} }
} }
function closeTryOnTool() {
function closeTryOnTool(){
YMK.close() YMK.close()
YMK.close() ? YMK_close.style.color = "transparent" : YMK_close.style.color = "black"; YMK.close() ? YMK_close.style.color = "transparent" : YMK_close.style.color = "black";
} }
function ajax_get(url, callback) {
function ajax_get( url, callback ){
var xmlhttp = new XMLHttpRequest(); var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { if( xmlhttp.readyState == 4 && xmlhttp.status == 200 ){
console.log('responseText:' + xmlhttp.responseText); console.log( 'responseText:' + xmlhttp.responseText );
try { try{
var data = JSON.parse(xmlhttp.responseText); var data = JSON.parse( xmlhttp.responseText );
} catch(err) { }catch( err ){
console.log(err.message + " in " + xmlhttp.responseText); console.log( err.message + " in " + xmlhttp.responseText );
return; return;
} }
callback(data); callback( data );
} }
}; };
xmlhttp.open("GET", url, true); xmlhttp.open( "GET", url, true );
xmlhttp.send(); xmlhttp.send();
} }
var collections; var collections;
var debug = true; var debug = true;
var rq = debug ? function(what,cfg, cb) { var rq = debug ? function( what, cfg, cb ){
getData(what, function(res){ getData( what, function( res ){
cb(res.collections.slice(-4)) cb( res.collections.slice( -4 ) )
}); } );
} : function(what,cfg, cb) { } : function( what, cfg, cb ){
ajax_get(apiURL+URLS[what](cfg), function(res) { ajax_get( apiURL + URLS[ what ]( cfg ), function( res ){
cb(res.collections.reverse()); cb( res.collections.reverse() );
}) } )
}; };
var loaded = {}; var loaded = {};
var collectionRQ = debug ? function(what,cfg, cb) { var collectionRQ = debug ? function( what, cfg, cb ){
getData(cfg.handle.substr(3).replace('-results', ''), function(res){ getData( cfg.handle.substr( 3 ).replace( '-results', '' ), function( res ){
cb(res.products) cb( res.products )
}); } );
} : function(what,cfg, cb) { } : function( what, cfg, cb ){
ajax_get(apiURL+URLS[what](cfg), function(res) { ajax_get( apiURL + URLS[ what ]( cfg ), function( res ){
cb(res.products); cb( res.products );
}) } )
}; };
var loadingSequence = function() { var loadingSequence = function(){
rq('collections', null, function(data) { rq( 'collections', null, function( data ){
collections = data; collections = data;
s.set('categoriesLoaded', 1); s.set( 'categoriesLoaded', 1 );
collections.forEach(function(item) { collections.forEach( function( item ){
collectionRQ('category', item, function(products) { collectionRQ( 'category', item, function( products ){
loaded[item.handle] = products; loaded[ item.handle ] = products;
s.set(item.handle+'-loaded', true); s.set( item.handle + '-loaded', true );
}) s.set( 'categoriesLoaded', s.get( 'categoriesLoaded' ) + 1 );
}); s.set( item.handle + '-notcollapsed', true );
} )
} );
}) } )
}; };
</script> </script>
<div style="display: flex"> <div style="display: flex">
<div style="min-width: 460px;position: relative;display: flex;flex-direction: column;"> <div style="min-width: 460px;position: relative;display: flex;flex-direction: column;">
<div id='YMK-module' style="width:450px;position: relative;display: block"></div> <div id='YMK-module' style="width:450px;position: relative;display: block"></div>
<div id="variant-info"></div> <div id="variant-info"></div>
</div> </div>
...@@ -207,87 +455,124 @@ ...@@ -207,87 +455,124 @@
var apiURL = 'https://www.mirrormirror.love/'; var apiURL = 'https://www.mirrormirror.love/';
var URLS = { var URLS = {
collections: function(){return 'collections.json';}, collections: function(){
category: function(item){ return 'collections.json';
},
category: function( item ){
return `collections/${item.handle}/products.json?limit=250?page=1`; return `collections/${item.handle}/products.json?limit=250?page=1`;
} }
}; };
loadingSequence(); loadingSequence();
var Input = function(cfg){ var Input = function( cfg ){
var dom = D.h('input', {cls:"field__input", attr: {type: 'text'}}); cfg = cfg || {};
if(cfg.bind){ var dom = D.h( 'input', { cls: "field__input", attr: { type: cfg.type || 'text' } } );
cfg.bind.sub(function (val) { if( cfg.bind ){
cfg.bind.sub( function( val ){
dom.value = val; dom.value = val;
}); } );
dom.addEventListener('input', function () { dom.addEventListener( 'input', function(){
cfg.bind.set(dom.value); cfg.bind.set( dom.value );
}) } )
} }
return dom; return dom;
}; };
var s = new Store({ var s = new Store( {
searchType: 'by-sku',
search: '', search: '',
categoriesLoaded: false categoriesLoaded: false,
}); searchColor: '#ff2f34',
var testIt = function(item, product, variant){ searchFacePart: 'LIPCOLOR'
//debugger } );
var img = variant.featured_image && variant.featured_image.src || ( product.images[ 0 ] || {} ).src; var testIt = function( item, product, variant ){
//debugger
console.log( { item, product, variant } ); var img = variant.featured_image && variant.featured_image.src || ( product.images[ 0 ] || {} ).src;
D.replaceChildren(
document.querySelector( '#variant-info' ), console.log( { item, product, variant } );
D.div( { cls: 'info' }, D.replaceChildren(
D.div( { cls: 'info-title' }, product.title ), document.querySelector( '#variant-info' ),
D.div( { cls: 'info-line' }, D.div( { cls: 'info' },
D.div({cls: 'preview'}, D.div( { cls: 'info-title' }, product.title ),
img && D.h('img', {src: img, cls: 'info-img'}), D.div( { cls: 'info-line' },
D.div( { cls: 'preview' },
img && D.h( 'img', { src: img, cls: 'info-img' } )
),
D.div( { cls: 'very-info' },
D.div( { D.div( {
cls: 'variant', cls: 'color',
style: { background: variant.option2 } style: { background: variant.option2 }
} ) }, D.span( { cls: 'color-span' }, D.span( { cls: 'prop' }, 'Color' ), variant.option1 ) ),
'SKU: ' + variant.option3
),
D.div({cls: 'very-info'},
'Color: '+variant.option1, D.h('br'),
'SKU: '+variant.option3, D.h('br'),
function(draw) {
var d = D.div({});
d.innerHTML = product.body_html;
draw(d);
}
)
) )
) ),
); D.div( { cls: 'info-description' }, function( draw ){
var d = D.div( {} );
d.innerHTML = product.body_html;
draw( d );
} )
)
);
YMK.applyMakeupBySku(variant.option3); YMK.applyMakeupBySku( variant.option3 );
}; };
s.sub( [ 'search', 'categoriesLoaded' ], Store.debounce( function( search, isLoaded ){
if( !isLoaded )
return;
search = search.toLowerCase().trim();
collections.forEach( function( collection ){
var products = loaded[ collection.handle ];
if( products ){
var filteredProducts = products.filter( function( product ){
var filteredVariants = product.variants.filter( function( variant ){
var shouldShow = variant.option3 &&
( search ?
variant.option3.toLowerCase().indexOf( search ) > -1
: true );
s.set( 'v' + variant.id + '-hidden', !shouldShow );
return shouldShow;
} );
s.set( 'p' + product.id + '-hidden', filteredVariants.length === 0 );
return filteredVariants.length > 0;
} );
s.set( collection.handle + '-count', filteredProducts.length );
s.set( collection.handle + '-hide', filteredProducts.length === 0 );
}else{
s.set( collection.handle + '-hide', true );
}
} )
}, 300 ) );
var collection = function(item){
return function( _ ){
s.sub( [ 'search', item.handle + '-loaded', item.handle + '-hide', item.handle + '-notcollapsed' ],
Store.debounce(function( search, isLoaded, shouldHide, notCollapsed ){
_( shouldHide ? void 0 :D.div( { cls: 'collection '+(notCollapsed ? '':'expanded') },
D.div( {
cls: 'collection-title', onclick: function(){
/*this.parentNode.classList.toggle( 'expanded' );
this.parentNode.classList.toggle( 'expanded' )*/
s.set(item.handle + '-notcollapsed', !(s.get(item.handle + '-notcollapsed')));
}
}, item.title ),
function( draw ){
if( !isLoaded ) var collection = function( item ){
return; return D.div( {
cls: D.cls( 'collection', {
hidden: s.valTrue( item.handle + '-hide' ),
expanded: s.valTrue( item.handle + '-notcollapsed' )
} )
},
var products = loaded[ item.handle ]; D.div( {
var mapped = products.map( function( product ){ cls: 'collection-title',
var variants = product.variants.filter( function( variant ){ onclick: function(){
return variant.option3 && (search ? variant.option3.toLowerCase().indexOf(search.toLowerCase())>-1: true); s.set( item.handle + '-notcollapsed', !( s.get( item.handle + '-notcollapsed' ) ) );
} ).map( function( variant ){ }
}, item.title, D.span( { cls: 'product-counter' }, s.val( item.handle + '-count' ) ) ),
function( draw ){
s.sub( [ item.handle + '-loaded' ], function( isLoaded ){
if( !isLoaded )
return;
var products = loaded[ item.handle ];
var mapped = products.map( function( product ){
return D.div( { cls: D.cls( 'product', { 'product-hidden': s.valTrue( 'p' + product.id + '-hidden' ) } ) },
D.div( { cls: 'product-title' }, product.title ),
D.div( { cls: 'variants' }, product.variants.map( function( variant ){
return D.div( { return D.div( {
cls: 'variant', cls: D.cls( 'variant', { 'variant-hidden': s.valTrue( 'v' + variant.id + '-hidden' ) } ),
style: { background: variant.option2 }, style: { background: variant.option2 },
onclick: function(){ onclick: function(){
[].slice.apply( document.querySelectorAll( '.variant.selected' ) ).forEach( function( el ){ [].slice.apply( document.querySelectorAll( '.variant.selected' ) ).forEach( function( el ){
...@@ -298,41 +583,209 @@ ...@@ -298,41 +583,209 @@
testIt( item, product, variant ) testIt( item, product, variant )
} }
} ) } )
} ); } ) )
if(variants.length === 0) )
return; } )
return D.div( { cls: 'product' }, .filter( function( a ){
D.div( { cls: 'product-title' }, product.title ),
D.div( { cls: 'variants' }, variants )
)
} )
.filter(function(a) {
return a; return a;
}); } );
s.set(item.handle + '-hide', mapped.length === 0); s.set( item.handle + '-hide', mapped.length === 0 );
draw( D.div( { cls: 'products' }, mapped ) ); draw( D.div( { cls: 'products' }, mapped ) );
} ) ) } );
}, 300) ); }
}; );
}; };
var authorizeButton = document.getElementById('authorize_button');
var signoutButton = document.getElementById('signout_button');
var cats, cats2, grm, categories, cp = document.getElementById( 'content-panel' );
D.div( {
renderTo: cp
},
D.div( { cls: 'search-type' },
D.h( 'label', { cls: 'field' },
new Radio( {
value: 'by-sku',
group: s.bind( 'searchType' )
} ),
'By SKU'
),
D.h( 'label', { cls: 'field' },
D.div({ new Radio( {
renderTo: document.getElementById('content-panel') value: 'by-color',
}, group: s.bind( 'searchType' )
new Input({bind: s.bind('search')}), } ),
D.div({cls: 'categories'}, function(draw) { 'By Color'
s.sub(['search', 'categoriesLoaded'], function(search, loaded) { )
if(loaded){ ),
draw(collections.map(collection));
}else{ D.div( {
draw('Loading collections') cls: D.cls( 'block', {
} hidden: Store.NOT(s.valEqual('searchType', 'by-sku'))
}) } )
}) },
D.div( { style: { position: 'relative' } },
D.div( {
cls: D.cls( 'cross', { hidden: s.valEqual( 'search', '' ) } ),
onclick: function(){
s.set( 'search', '' )
}
}, 'x' ),
new Input( { bind: s.bind( 'search' ) } )
),
cats = D.div( { cls: 'categories' }, function( draw ){
s.sub( [ 'search', 'categoriesLoaded' ], function( search, loaded ){
if( loaded ){
draw( collections.map( collection ) );
}else{
draw( 'Loading collections' )
}
} )
} )
),
D.div( {
cls: D.cls( 'block', {
hidden: Store.NOT(s.valEqual('searchType', 'by-color'))
} )
},
grm = D.div( { style: { position: 'relative' } },
D.div({style: {display: 'flex'}},
new Input( { bind: s.bind( 'searchColor' ) } ),
new Input( { bind: s.bind( 'searchColor' ), type: 'color' } ),
authorizeButton = D.h('Button', {}, 'Sign in'),
signoutButton = D.h('Button', {}, 'Sign out')
)
),
categories = D.div({cls: 'search-categories'}),
cats2 = D.div( { cls: 'categories' }, function( draw ){
s.sub( [ 'searchColor', 'skusLoaded' ], function( search, loaded ){
if( loaded ){
//draw( collections.map( collection ) );
}else{
draw( 'Loading collections' )
}
} )
} )
)
); );
s.sub(['searchColor'], function(searchColor) {
if(searchColor[0] !== '#')
s.set('searchColor', '#'+searchColor);
});
var fn = function(){
if(cats.offsetTop){
cp.style.minHeight = cats.style.height = Math.min( window.innerHeight + pageYOffset - ( cats.offsetTop + cats.offsetParent.offsetTop ) - 32, cats.scrollHeight, window.innerHeight - 32 ) + 'px';
}else if(cats2.offsetTop){
cp.style.minHeight = cats2.style.height = Math.min( window.innerHeight + pageYOffset - ( cats2.offsetTop + cats2.offsetParent.offsetTop ) - 32, cats2.scrollHeight, window.innerHeight - 32 ) + 'px';
}
};
fn();
window.addEventListener( 'scroll', Store.debounce( fn, 300 ) );
s.sub( [ 'search', 'categoriesLoaded', 'searchColor', 'skusLoaded'], Store.debounce( fn, 300 ) );
setTimeout( fn, 1000 );
window.addEventListener( 'resize', fn );
function appendPre(message) {
var pre = grm;
var textContent = document.createTextNode(message + '\n');
pre.appendChild(textContent);
}
// Client ID and API key from the Developer Console
var ACLIENT_ID = "838942638829-3koe535vg4adclpd01sd3nnmi250h2ra.apps.googleusercontent.com";
var AAPI_KEY = "AIzaSyD13Vbl1iq36HFABoVa27-VcOyqSMYNTZw";//"AIzaSyDx2DNm9fX9VXh6YzKEg5JybYSE6A6dZLg";
// Array of API discovery doc URLs for APIs used by the quickstart
var DISCOVERY_DOCS = ["https://sheets.googleapis.com/$discovery/rest?version=v4"];
// Authorization scopes required by the API; multiple scopes can be
// included, separated by spaces.
var SCOPES = "https://www.googleapis.com/auth/spreadsheets.readonly";
function updateSigninStatus(isSignedIn) {
if (isSignedIn) {
authorizeButton.style.display = 'none';
signoutButton.style.display = 'block';
listMajors();
} else {
authorizeButton.style.display = 'block';
signoutButton.style.display = 'none';
}
}
function handleClientLoad() {
gapi.load('client:auth2', function initClient() {
gapi.client.init({
apiKey: AAPI_KEY,
clientId: ACLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES
}).then(function () {
// Listen for sign-in state changes.
gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
// Handle the initial sign-in state.
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
authorizeButton.onclick = handleAuthClick;
signoutButton.onclick = handleSignoutClick;
}, function(error) {
appendPre(JSON.stringify(error, null, 2));
});
});
}
function handleAuthClick(event) {
gapi.auth2.getAuthInstance().signIn();
}
/**
* Sign out the user upon button click.
*/
function handleSignoutClick(event) {
gapi.auth2.getAuthInstance().signOut();
}
var values;
function listMajors() {
gapi.client.sheets.spreadsheets.values.get({
spreadsheetId: '1EkUKPUf2uedFd55lUj4_LQOb1EUXfcN8j96KU1qTy3w',
range: 'SKU!A2:F',
}).then(function(response) {
values = response.result.values;
D.replaceChildren(categories, Object.keys(values.reduce(function(store, a) {
store[a[0]] = true;
return store;
}, {})).map(function(category) {
return D.h( 'label', { cls: 'field' },
new Radio( {
value: category,
group: s.bind( 'searchFacePart' )
} ),
category
);
}));
s.set('skusLoaded', true);
}, function(response) {
appendPre('Error: ' + response.result.error.message);
});
}
</script>
<script async defer src="https://apis.google.com/js/api.js"
onload="this.onload=function(){};handleClientLoad()"
onreadystatechange="if (this.readyState === 'complete') this.onload()">
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment