-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from issartdeveloper/master
ISS Art fork
- Loading branch information
Showing
38 changed files
with
1,366 additions
and
5,511 deletions.
There are no files selected for viewing
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,4 +1,6 @@ | ||
index.html | ||
test.html | ||
testpage2.html | ||
testpage1.html | ||
testpages/* | ||
testpages/* | ||
node_modules/** | ||
build/** |
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,75 @@ | ||
define(["./base64"], function(base64) { | ||
|
||
var _options = {}; | ||
function options() { | ||
return _options; | ||
} | ||
|
||
function _topDomain(domain) { | ||
return domain.split('.').slice(-2).join('.'); | ||
} | ||
|
||
|
||
function init(opts) { | ||
_options.expirationDays = opts.expirationDays || _options.expirationDays; | ||
var domain = (opts.domain !== undefined) ? opts.domain : _topDomain(window.location.hostname); | ||
_options.domain = domain || null; | ||
} | ||
|
||
function get(name) { | ||
try { | ||
var matches = document.cookie.match(new RegExp( | ||
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)")); | ||
var value = matches ? decodeURIComponent(matches[1]) : undefined; | ||
if (value) { | ||
return JSON.parse(base64.decode(value)); | ||
} | ||
return null; | ||
} catch (e) { | ||
return null; | ||
} | ||
}; | ||
|
||
|
||
function set(name, value) { | ||
try { | ||
_set(name, base64.encode(JSON.stringify(value))); | ||
} catch (e) { | ||
} | ||
} | ||
|
||
|
||
function _set(name, value) { | ||
var expires = value !== null ? _options.expirationDays : -1 ; | ||
if (expires) { | ||
var date = new Date(); | ||
date.setTime(date.getTime() + (expires * 24 * 60 * 60 * 1000)); | ||
expires = date; | ||
} | ||
var cookie = name + '=' + value; | ||
if (expires) { | ||
cookie += '; expires=' + expires.toUTCString(); | ||
} | ||
cookie += '; path=/'; | ||
if (_options.domain) { | ||
cookie += '; domain=' + _options.domain; | ||
} | ||
document.cookie = cookie; | ||
} | ||
|
||
function remove(name) { | ||
try { | ||
_set(name, null); | ||
} catch (e) { | ||
} | ||
} | ||
|
||
|
||
return { | ||
options: options, | ||
get: get, | ||
set: set, | ||
remove: remove, | ||
init: init | ||
}; | ||
}); |
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,19 @@ | ||
define(function() { | ||
return { | ||
apiEndpoint: 'https://api.tongrd.com/v2/events', | ||
cookieExpirationDays: 365 * 5, | ||
cookieName: 'tongdao_id', | ||
domain: undefined, | ||
includeUtm: false, | ||
language: require('./Language').getLanguage(), | ||
optOut: false, | ||
platform: 'Web', | ||
sessionTimeout: 30 * 60 * 1000, | ||
unsentKey: 'tongdao_unsent', | ||
unsentIdentifyKey: 'tongdao_unsent_identify', | ||
uploadBatchSize: 100, | ||
eventUploadThreshold: 30, | ||
eventUploadPeriodMillis: 30 * 1000, | ||
changeUrlDetectionMillis: 500 | ||
} | ||
}); |
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,8 @@ | ||
define(function() { | ||
return { | ||
getLanguage: function getLanguage() { | ||
return (navigator && ((navigator.languages && navigator.languages[0]) || | ||
navigator.language || navigator.userLanguage)) || undefined; | ||
} | ||
}; | ||
}); |
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,43 @@ | ||
define(function() { | ||
|
||
var Request = function(url, data, appKey, async) { | ||
this.url = url; | ||
this.data = data || {}; | ||
this.appKey = appKey; | ||
this.async = async; | ||
}; | ||
|
||
Request.prototype.post = function(callback) { | ||
var isIE = window.XDomainRequest ? true : false; | ||
var data = JSON.stringify(this.data); | ||
if (isIE) { | ||
var xdr = new window.XDomainRequest(); | ||
xdr.open('POST', this.url, this.async); | ||
xdr.onload = function() { | ||
callback(200, xdr.responseText); | ||
}; | ||
xdr.onerror = function () { | ||
if (xdr.responseText === 'Request Entity Too Large') { | ||
callback(413, xdr.responseText); | ||
} else { | ||
callback(500, xdr.responseText); | ||
} | ||
}; | ||
xdr.ontimeout = function () {}; | ||
xdr.onprogress = function() {}; | ||
xdr.send(data); | ||
} else { | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('POST', this.url, this.async); | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState === 4) { | ||
callback(xhr.status, xhr.responseText); | ||
} | ||
}; | ||
xhr.setRequestHeader('X-APP-KEY', this.appKey); | ||
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); | ||
xhr.send(data); | ||
} | ||
} | ||
return Request; | ||
}); |
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,43 @@ | ||
define(function() { | ||
|
||
function TdOrder() { | ||
} | ||
|
||
TdOrder.prototype.setOrderId = function(id) { | ||
this['!order_id'] = id; | ||
}; | ||
|
||
TdOrder.prototype.setCurrency = function(currency) { | ||
this['!currency'] = currency; | ||
}; | ||
|
||
TdOrder.prototype.setTotal = function(total) { | ||
this['!total'] = total; | ||
}; | ||
|
||
TdOrder.prototype.setRevenue = function(revenue) { | ||
this['!revenue'] = revenue; | ||
}; | ||
|
||
TdOrder.prototype.setOrderLines = function(orderLines) { | ||
this['!order_lines'] = orderLines; | ||
}; | ||
|
||
TdOrder.prototype.setShipping = function(shipping) { | ||
this['!shipping'] = shipping; | ||
}; | ||
|
||
TdOrder.prototype.setTax = function(tax) { | ||
this['!tax'] = tax; | ||
}; | ||
|
||
TdOrder.prototype.setDiscount = function(discount) { | ||
this['!discount'] = discount; | ||
}; | ||
|
||
TdOrder.prototype.setCouponId = function(couponId) { | ||
this['!coupon_id'] = couponId; | ||
}; | ||
|
||
return TdOrder; | ||
}); |
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,15 @@ | ||
define(function() { | ||
|
||
function TdOrderLine() { | ||
} | ||
|
||
TdOrderLine.prototype.setProduct = function(product) { | ||
this['!product'] = product; | ||
}; | ||
|
||
TdOrderLine.prototype.setQuantity = function(quantity) { | ||
this['!quantity'] = quantity; | ||
}; | ||
|
||
return TdOrderLine; | ||
}); |
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,31 @@ | ||
define(function() { | ||
|
||
function TdProduct() { | ||
} | ||
|
||
TdProduct.prototype.setId = function(id) { | ||
this['!id'] = id; | ||
}; | ||
|
||
TdProduct.prototype.setCurrency = function(currency) { | ||
this['!currency'] = currency; | ||
}; | ||
|
||
TdProduct.prototype.setSku = function(sku) { | ||
this['!sku'] = sku; | ||
}; | ||
|
||
TdProduct.prototype.setName = function(name) { | ||
this['!name'] = name; | ||
}; | ||
|
||
TdProduct.prototype.setPrice = function(price) { | ||
this['!price'] = price; | ||
}; | ||
|
||
TdProduct.prototype.setCategory = function(category) { | ||
this['!category'] = category; | ||
}; | ||
|
||
return TdProduct; | ||
}); |
Oops, something went wrong.