Skip to content

Commit

Permalink
release: 1.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Repro Bot committed Feb 11, 2018
1 parent e515d59 commit f8df5b5
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 54 deletions.
Binary file modified Repro.embeddedframework/Repro.framework/Info.plist
Binary file not shown.
Binary file modified Repro.embeddedframework/Repro.framework/Repro
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,43 +1,164 @@
// Generated by CoffeeScript 1.10.0
(function() {
var repro, track;
var getAbsoluteOffsetFromBody, getOS, mask, prevSensitiveElementData, repro, sendMessageToSDK, sensitiveElements, timerForMasking, track, unmask, watch, scalesPageToFit, parseMetaContent;

sensitiveElements = {};

prevSensitiveElementData = {};

timerForMasking = null;

track = function(name, _props) {
var bridge, key, result, url, value;
if (typeof name !== 'string' || name === '') {
var data;
if (typeof name !== 'string' || name === '' || ((typeof _props !== 'object') && _props !== undefined)) {
return;
}
name = encodeURIComponent(name);
result = '';
if (typeof _props === 'object') {
for (key in _props) {
value = _props[key];
result += (encodeURIComponent(key)) + "=" + (encodeURIComponent(value)) + "&";
if (_props === null || _props === undefined) {
_props = {};
}
data = {
name: name,
properties: _props
};
return sendMessageToSDK('repro://track?data=' + JSON.stringify(data));
};

watch = function() {
var _e, _k, cur, data, offset, prev, fit;
if (Object.keys(sensitiveElements).length === 0) {
return;
}
data = [];
fit = scalesPageToFit();
for (_k in sensitiveElements) {
_e = sensitiveElements[_k];
offset = getAbsoluteOffsetFromBody(_e);
cur = {
x: offset.left,
y: offset.top,
w: _e.offsetWidth,
h: _e.offsetHeight,
key: _k,
ww: document.documentElement.clientWidth,
wh: document.documentElement.clientHeight,
fixed: (window.getComputedStyle(_e, null).position === "fixed"),
fit: fit
};
prev = prevSensitiveElementData[_k];
if (prev !== void 0 && prev !== null) {
if (cur.x === prev.x && cur.y === prev.y && cur.w === prev.w && cur.h === prev.h) {
continue;
}
}
result = result.slice(0, result.length - 1);
data.push(cur);
prevSensitiveElementData[_k] = cur;
}
if (result) {
url = 'repro://' + name + '?' + result;
} else {
url = 'repro://' + name;
if (Object.keys(data).length > 0) {
return sendMessageToSDK('repro://mask?data=' + JSON.stringify(data));
}
bridge = document.getElementById('repro-insight-bridge');
if (bridge) {
return bridge.src = url;
};

mask = function(key, el) {
if (timerForMasking === null) {
timerForMasking = setInterval(watch, 50);
}
if (typeof key !== 'string' || key === '' || el === null) {
return;
}
return sensitiveElements[key] = el;
};

unmask = function(key) {
var data;
if (typeof key !== 'string' || key === '') {
return;
}
delete sensitiveElements[key];
delete prevSensitiveElementData[key];
data = {
key: key
};
return sendMessageToSDK('repro://unmask?data=' + JSON.stringify(data));
};

getAbsoluteOffsetFromBody = function(el) {
var _x, _y;
_x = 0;
_y = 0;
while (el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) {
_x += el.offsetLeft + el.clientLeft;
_y += el.offsetTop + el.clientTop;
el = el.offsetParent;
}
return {
top: _y,
left: _x
};
};

getOS = function() {
var userAgent;
userAgent = void 0;
userAgent = navigator.userAgent || navigator.vendor || window.opera;
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i) || userAgent.match(/iPod/i)) {
return "iOS";
} else if (userAgent.match(/Android/i)) {
return "Android";
} else {
bridge = document.createElement('iframe');
bridge.setAttribute('style', 'display:none;');
bridge.setAttribute('height', '0px');
bridge.setAttribute('width', '0px');
bridge.setAttribute('frameborder', '0');
bridge.setAttribute('id', 'repro-insight-bridge');
document.documentElement.appendChild(bridge);
return bridge.src = url;
return "unknown";
}
};

sendMessageToSDK = function(url) {
var bridge;
bridge = document.createElement('iframe');
bridge.setAttribute('style', 'display:none;');
bridge.setAttribute('height', '0px');
bridge.setAttribute('width', '0px');
bridge.setAttribute('frameborder', '0');
bridge.setAttribute('id', 'repro-sdk-bridge');
bridge.setAttribute('src', url);
document.documentElement.appendChild(bridge);
bridge.parentNode.removeChild(bridge);
return bridge = null;
};

scalesPageToFit = function() {
var metas, parsed;
metas = document.getElementsByTagName("meta");
for (var i = 0; i < metas.length; i++) {
if (metas[i].name === "viewport") {
parsed = parseMetaContent(metas[i].content);
}
}
if (parsed['width'] === 'device-width' &&
parsed['height'] === 'device-height' &&
parsed['initial-scale'] === '1.0' &&
parsed['maximum-scale'] === '1.0') {
return false;
}
return true;
}

parseMetaContent = function(str) {
var contents, parsed;
if (typeof str !== 'string') {
return null;
}
contents = str.split(',');
parsed = {};
for (var i = 0; i < contents.length; i++) {
var s = contents[i].trim().split("=");
if (s.length === 2) {
parsed[s[0]] = s[1];
}
}
return parsed;
}

repro = {
track: track
track: track,
mask: mask,
unmask: unmask
};

window.repro = repro;
Expand Down
Binary file not shown.
175 changes: 148 additions & 27 deletions Repro.embeddedframework/Resources/ReproSDKResources.bundle/repro.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,164 @@
// Generated by CoffeeScript 1.10.0
(function() {
var repro, track;
var getAbsoluteOffsetFromBody, getOS, mask, prevSensitiveElementData, repro, sendMessageToSDK, sensitiveElements, timerForMasking, track, unmask, watch, scalesPageToFit, parseMetaContent;

sensitiveElements = {};

prevSensitiveElementData = {};

timerForMasking = null;

track = function(name, _props) {
var bridge, key, result, url, value;
if (typeof name !== 'string' || name === '') {
var data;
if (typeof name !== 'string' || name === '' || ((typeof _props !== 'object') && _props !== undefined)) {
return;
}
name = encodeURIComponent(name);
result = '';
if (typeof _props === 'object') {
for (key in _props) {
value = _props[key];
result += (encodeURIComponent(key)) + "=" + (encodeURIComponent(value)) + "&";
if (_props === null || _props === undefined) {
_props = {};
}
data = {
name: name,
properties: _props
};
return sendMessageToSDK('repro://track?data=' + JSON.stringify(data));
};

watch = function() {
var _e, _k, cur, data, offset, prev, fit;
if (Object.keys(sensitiveElements).length === 0) {
return;
}
data = [];
fit = scalesPageToFit();
for (_k in sensitiveElements) {
_e = sensitiveElements[_k];
offset = getAbsoluteOffsetFromBody(_e);
cur = {
x: offset.left,
y: offset.top,
w: _e.offsetWidth,
h: _e.offsetHeight,
key: _k,
ww: document.documentElement.clientWidth,
wh: document.documentElement.clientHeight,
fixed: (window.getComputedStyle(_e, null).position === "fixed"),
fit: fit
};
prev = prevSensitiveElementData[_k];
if (prev !== void 0 && prev !== null) {
if (cur.x === prev.x && cur.y === prev.y && cur.w === prev.w && cur.h === prev.h) {
continue;
}
}
result = result.slice(0, result.length - 1);
data.push(cur);
prevSensitiveElementData[_k] = cur;
}
if (result) {
url = 'repro://' + name + '?' + result;
} else {
url = 'repro://' + name;
if (Object.keys(data).length > 0) {
return sendMessageToSDK('repro://mask?data=' + JSON.stringify(data));
}
bridge = document.getElementById('repro-insight-bridge');
if (bridge) {
return bridge.src = url;
};

mask = function(key, el) {
if (timerForMasking === null) {
timerForMasking = setInterval(watch, 50);
}
if (typeof key !== 'string' || key === '' || el === null) {
return;
}
return sensitiveElements[key] = el;
};

unmask = function(key) {
var data;
if (typeof key !== 'string' || key === '') {
return;
}
delete sensitiveElements[key];
delete prevSensitiveElementData[key];
data = {
key: key
};
return sendMessageToSDK('repro://unmask?data=' + JSON.stringify(data));
};

getAbsoluteOffsetFromBody = function(el) {
var _x, _y;
_x = 0;
_y = 0;
while (el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) {
_x += el.offsetLeft + el.clientLeft;
_y += el.offsetTop + el.clientTop;
el = el.offsetParent;
}
return {
top: _y,
left: _x
};
};

getOS = function() {
var userAgent;
userAgent = void 0;
userAgent = navigator.userAgent || navigator.vendor || window.opera;
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i) || userAgent.match(/iPod/i)) {
return "iOS";
} else if (userAgent.match(/Android/i)) {
return "Android";
} else {
bridge = document.createElement('iframe');
bridge.setAttribute('style', 'display:none;');
bridge.setAttribute('height', '0px');
bridge.setAttribute('width', '0px');
bridge.setAttribute('frameborder', '0');
bridge.setAttribute('id', 'repro-insight-bridge');
document.documentElement.appendChild(bridge);
return bridge.src = url;
return "unknown";
}
};

sendMessageToSDK = function(url) {
var bridge;
bridge = document.createElement('iframe');
bridge.setAttribute('style', 'display:none;');
bridge.setAttribute('height', '0px');
bridge.setAttribute('width', '0px');
bridge.setAttribute('frameborder', '0');
bridge.setAttribute('id', 'repro-sdk-bridge');
bridge.setAttribute('src', url);
document.documentElement.appendChild(bridge);
bridge.parentNode.removeChild(bridge);
return bridge = null;
};

scalesPageToFit = function() {
var metas, parsed;
metas = document.getElementsByTagName("meta");
for (var i = 0; i < metas.length; i++) {
if (metas[i].name === "viewport") {
parsed = parseMetaContent(metas[i].content);
}
}
if (parsed['width'] === 'device-width' &&
parsed['height'] === 'device-height' &&
parsed['initial-scale'] === '1.0' &&
parsed['maximum-scale'] === '1.0') {
return false;
}
return true;
}

parseMetaContent = function(str) {
var contents, parsed;
if (typeof str !== 'string') {
return null;
}
contents = str.split(',');
parsed = {};
for (var i = 0; i < contents.length; i++) {
var s = contents[i].trim().split("=");
if (s.length === 2) {
parsed[s[0]] = s[1];
}
}
return parsed;
}

repro = {
track: track
track: track,
mask: mask,
unmask: unmask
};

window.repro = repro;
Expand Down

0 comments on commit f8df5b5

Please sign in to comment.