Hi I am trying to embed the redbubble code into my site for a client (his red bubble store) into a joomla site and there is something wrong with the script.
<script type="text/javascript" src="http://www.redbubble.com/assets/external_portfolio.js"></script>
<script id="rb-xzfcxvzx" type="text/javascript">new RBExternalPortfolio('www.redbubble.com', 'classiceggshell', 5, 5).renderIframe();</script>
The link it includes returns a 404 error when I check it on the devtools in chrome I tested the script on Jslint it gave me these eight warnings
Expected an identifier and instead saw '<'.
Expected an assignment or function call and instead saw an expression.
Missing semicolon.
Expected an assignment or function call and instead saw an expression.
Missing semicolon.
Missing semicolon.
Unclosed regular expression.
Unrecoverable syntax error. (85% scanned).
So is there something fundamentally wrong with the code would anyone please be able to fix this and give me the correct code to connect to his store. I have tried to load the link to his store into an Iframe but I think redbubble have a block on the iframes as the iframe wont load and has a X-Frame-Options: SAMEORIGIN error.
I have tried speaking to the support for redbubble and they are still yet to get back to me
Please be aware when replying that although I do have some knowledge and can follow step by step instructions I have very little coding knowledge as normally things like this are straightforward.
Alright I had the same issue, for some reason the script isn't there but I was able to find it:
RBExternalPortfolio = function(t, e, n, i) {
var a = this;
a.domain = t, a.rows = n, a.columns = i, a.user_name = e, a.getHeight = function() {
return 222 * a.rows + 85
}, a.getWidth = function() {
return 240 * a.columns + 26
}, a.getSrc = function() {
return "http://" + a.domain + "/people/" + a.user_name + "/external-portfolio?count=" + a.rows * a.columns
}, a.createIframe = function() {
var t = document.createElement("iframe");
return t.src = a.getSrc(), t.width = a.getWidth(), t.height = a.getHeight(), t.frameBorder = 0, t.scrolling = "no", t.setAttribute("allowtransparency", "true"), t
}, a.renderIframe = function() {
var t = document.getElementById("rb-xzfcxvzx");
t.parentNode.replaceChild(a.createIframe(), t)
}
};
From: http://nerdyjs.com/script/1406714
I then saved a copy locally, and changed the getSrc line to hardcode point to my folio, like this:
return "http://redbubble.com/people/<yourname>/external-portfolio?count=" + a.rows * a.columns
It sucks that they haven't fixed it yet but the code at least is out there!
Related
I'm having some problem with a lightning component that was done by other developer that left the company, users are telling me that the tool was working perfectly 1 month ago but i don't have any idea of what is happening then
The error is :
This page has an error. You might just need to refresh it. Action
failed: c:EMB_CCW_Panel$controller$onPickFile [Locker: Cannot
"createObjectURL" using a unsecure [object File]!] Failing descriptor:
{c:EMB_CCW_Panel$controller$onPickFile}
and the javascript method is this one
onPickFile : function(component, event, helper) {
var catalog = component.get("v.catalogWrapper");
var brandsList = component.get("v.brandsList");
console.log("onPickFile", catalog);
var file = event.target.files[0];
var fileURL = URL.createObjectURL(file);
var req = new XMLHttpRequest();
req.open('GET', fileURL);
req.onload = function() {
URL.revokeObjectURL(fileURL);
component.set("v.catalogWrapper",
helper.fillCatalogWithXMLData(catalog, helper.extractSlideNotesFromODTContentXML(this.responseXML), brandsList));
};
req.onerror = function() {
URL.revokeObjectURL(fileURL);
console.log('Error loading XML file.');
};
req.send();
},
and the helper methods,
extractSlideNotesFromODTContentXML : function(xmlDoc){
var output = [];
var slides = xmlDoc.getElementsByTagName("draw:page");
for(var s=0;s<slides.length;s++){
var notes = slides[s].getElementsByTagName("presentation:notes")[0].getElementsByTagName("draw:frame")[0].getElementsByTagName("draw:text-box")[0].getElementsByTagName("text:p");
var slideNotesList = [];
for(var i =0;i<notes.length;i++){
slideNotesList.push(notes[i].textContent);
}
output.push(slideNotesList);
}
return output;
},
fillCatalogWithXMLData : function(catalog, slidesList, brandsList){
try {
var referenceRegEX = /^(\d){9}/;
for(var i=0;i<slidesList.length;i++){
catalog.slides.splice(i, 0, this.generateSlideObject(i+1));
for(var j=0;j<slidesList[i].length;j++){
var wholeLine = slidesList[i][j];
var firstWord = wholeLine.split(" ")[0].toUpperCase();
console.log('firstWord', firstWord)
// Lines that begin with a number are references (SAP Id code). Consider the rest brand names:
if(referenceRegEX.test(firstWord) && firstWord.length == 9){
catalog.slides[i].referencesText += wholeLine+"\n";
}else{
// That's not a reference, check if it's a brand:
// 1.- Check if the whole line is a brand (removing leading and trailing spaces)
if(brandsList.includes(wholeLine.trim())){
// Found brand:
catalog.slides[i].brandsText += wholeLine + "\n";
}else{
// Not found, not recognized:
catalog.slides[i].unrecognizedText += wholeLine + "\n";
}
}
}
}
component.set("v.catalogWrapper", catalog);
} catch(err) {
}
return catalog;
}
anyone can't help me or tell me how can i fixe it !
thanks
If it used to work 1 month ago it's probably something Salesforce patched in Summer release. No idea what (if anything) is unsecure in your code but sounds like you're hit by Lightning Locker Service. Do you get same result in different browsers?
See if it works if you knock back the API version of component to version 39. It's a hack but might be a temp relief while you figure out what to do.
This suggests File is supported all right: https://developer.salesforce.com/docs/component-library/tools/locker-service-viewer
Maybe you need to read the file's content different way, maybe you need to give up on parsing it with JavaScript and push to server-side apex? I don't know what your functionality is.
If you go to setup -> lightning components -> debug mode and enable for yourself it might help a bit. You will see more human-friendly code generated in browser's developer tools, debugging might be simpler. Lesson learned would be to pay more attention to release preview windows (from ~September 12th we can preview Winter'21 release, SF should publish blog post about it in 1-2 weeks)
This looks promising: https://salesforce.stackexchange.com/a/245232/799
Maybe your code needs proper Aura accessors, event.getSource().get("v.files")[0] instead of event.target.files[0]. You really would have to debug it and experiment in browser's console, see what sticks.
I'm doing some optimisation on a site Ive recently taken over. I've found a script I don't recognise:
http://static.ak.fbcdn.net/rsrc.php/zo/r/V95Lkt_uLNB.js
It could be a facebook thing, and there's some key logging going on (that Im not too keen on)
It is without a doubt the largest file being requested on a page load (87kb) so if I can do without it, it'll really speed up the page load.
Does anyone know:
A) What it is
B) What it's for
C) What it does
D) Can I do without it
Okay so I had a look over the beautified version of this minified code and have noted the following:
By itself these are a bunch of utility functions.
CavalryLogger doesn't do anything with this file by itself because it doesn't exist, nor is it defined.
The code in question regarding key binding:
function KeyEventController() {
copy_properties(this, {
handlers: {}
});
document.onkeyup = this.onkeyevent.bind(this, 'onkeyup');
document.onkeydown = this.onkeyevent.bind(this, 'onkeydown');
document.onkeypress = this.onkeyevent.bind(this, 'onkeypress');
}
copy_properties(KeyEventController, {
instance: null,
getInstance: function () {
return KeyEventController.instance || (KeyEventController.instance = new KeyEventController());
},
defaultFilter: function (event, a) {
event = $E(event);
return KeyEventController.filterEventTypes(event, a) && KeyEventController.filterEventTargets(event, a) && KeyEventController.filterEventModifiers(event, a);
},
filterEventTypes: function (event, a) {
if (a === 'onkeydown') return true;
return false;
},
filterEventTargets: function (event, b) {
var a = $E(event).getTarget();
if (DOM.isNode(a, ['input', 'select', 'textarea', 'object', 'embed'])) if (a.type != 'checkbox' && a.type != 'radio' && a.type != 'submit') return false;
return a.getAttribute('contentEditable') != 'true';
},
filterEventModifiers: function (event, a) {
if (event.ctrlKey || event.altKey || event.metaKey || event.repeat) return false;
return true;
},
registerKey: function (f, a, d, g) {
if (d === undefined) d = KeyEventController.defaultFilter;
var b = KeyEventController.getInstance();
var c = b.mapKey(f);
if (is_empty(b.handlers)) onleaveRegister(b.resetHandlers.bind(b));
for (var e = 0; e < c.length; e++) {
f = c[e];
if (!b.handlers[f] || g) b.handlers[f] = [];
b.handlers[f].push({
callback: a,
filter: d
});
}
},
keyCodeMap: {
'[': [219],
']': [221],
'`': [192],
LEFT: [KEYS.LEFT, 63234],
RIGHT: [KEYS.RIGHT, 63235],
RETURN: [KEYS.RETURN],
TAB: [KEYS.TAB],
DOWN: [KEYS.DOWN, 63233],
UP: [KEYS.UP, 63232],
ESCAPE: [KEYS.ESC],
BACKSPACE: [KEYS.BACKSPACE],
DELETE: [KEYS.DELETE]
}
});
copy_properties(KeyEventController.prototype, {
mapKey: function (a) {
if (typeof (a) == 'number') return [48 + a, 96 + a];
if (KeyEventController.keyCodeMap[a.toUpperCase()]) return KeyEventController.keyCodeMap[a.toUpperCase()];
var b = a.toUpperCase().charCodeAt(0);
return [b];
},
onkeyevent: function (i, c) {
c = $E(c);
var d = null;
var g = this.handlers[c.keyCode];
var b, f, a;
if (g) for (var h = 0; h < g.length; h++) {
b = g[h].callback;
f = g[h].filter;
try {
if (!f || f(c, i)) {
var node = null;
if (window.Parent && Parent.byTag && c.getTarget) node = Parent.byTag(c.getTarget(), 'a');
user_action(node, 'key', c);
a = b(c, i);
if (a === false) return Event.kill(c);
}
} catch (e) {}
}
return true;
},
resetHandlers: function () {
this.handlers = {};
}
});
This code lets you bind keys to callbacks, and includes more human readable names for common keys. Take for example the usage here:
KeyEventController.registerKey('ESCAPE', Dialog._handleEscapeKey, a);
The ESCAPE key is registered to make Dialogs go away. handlers is also empty by default, so nothing is going to happen until you use registerKey or append to it manually. Note that this is the only instance of registerKey being called.
It also has a lot of AJAX utility functions. Can't really send anything to Facebook from your domain anyways because of same origin policy (unless you modified security permissions, but then that's your fault). Same thing with the cookies set.
There's also a history manger, but it uses an iFrame so it won't be able to read it from your domain anyways.
Finally the like button code I found is an iFrame, so it wouldn't need JS includes unless you were using javascript to create the iFrame or something.
With that in mind I don't see the need for you to include all this.
It looks like this is directly connected to having the "Like this" functionality on a page. The iframe you use to include the 'Like' button seems to come with a couple of 'bonus' scripts.
If you ask me, this is another good reason to NOT have Facebook integrated, it appears to be logging keypresses, and that is not cool.
A quick google search doesn't provide alot of answers - it's some sort of event tracking script for Facebook, and I saw a tweet and a couple of forum posts where people mentioned disabling it and gaining a speed boost - I think you can safely get rid of it, atleast it's worth giving it a try.
This is definitely from Facebook - one of many supporting files for FBML / API / etc.
If you are not using any FB features in your project, simply remove this file.
If you are using any FB features (like 'Like' button), you shouldn't use this file (or any other files with cryptic names) directly either.
You should instead
1) create empty <div id="fb-root"></div> somewhere at the end f your page
2) include http://connect.facebook.net/en_US/all.js script in your page
3) follow further instructions from http://developers.facebook.com/
When the IFRAME is loaded it calls the following URI:
https://www.facebook.com/plugins/like.php?api_key=[your_api_key]&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D27%23cb%3Df39f390d40f7332%26domain%3D[your_TLD]%26origin%3Dhttp%253A%252F%252F[your_TLD]%252Ff72f1f9bea899e%26relation%3Dparent.parent&colorscheme=light&extended_social_context=false&href=[your_share_URI]&layout=button_count&locale=en_US&node_type=link&sdk=joey&send=false&show_faces=false&width=100
Within the script tags of this page are the following calls.
PluginAsyncLoader.load("**https:\/\/fbstatic-a.akamaihd.net\/rsrc.php\/v2\/yq\/r\/CNRdIwfy3yI.js**");
PluginAsyncLoader.ondemandjs = "**https:\/\/fbstatic-a.akamaihd.net\/rsrc.php\/v2\/yH\/r\/muz85bheueJ.js**";
I found "calverly logger" in a file that I did not download but I saw it download right in front of me when I closed Thunderbird (was running Firefox behind it and it showed up there as a file downloading) so went to check what it was.
The file was called: "See All.html" which I found odd and worrying.
the head of the file contains the following code indicating it is a Facebook function...
The Calvery Logger is mentioned near the bottom of the file (not shown here). I have stripped out the html < near the head of the file so that you can see the code... Not sure it will help but look forward to any insights...
// !DOCTYPE html
html lang="en" id="facebook" class="no_js"
head
meta charset="utf-8" />
meta name="referrer" content="origin-when-crossorigin" id="meta_referrer" />
script> window._cstart=+new Date();</script><script>function envFlush(a) {function b(c){for(var d in a)c[d]=a[d];}if(window.requireLazy){window.requireLazy(['Env'],b);}else{window.Env=window.Env||{};b(window.Env);}}envFlush({"ajaxpipe_token":"AXiYOZarFarwOff3","lhsh":"AAQFK_mp-","khsh":"0`sj`e`rm`s-0fdu^gshdoer-0gc^eurf-3gc^eurf;1;enbtldou;fduDmdldourCxO`ld-2YLMIuuqSdptdru;qsnunuxqd;rdoe-0unjdojnx-0unjdojnx0-0gdubi^rdbsduOdv-0`sj`e`r-0q`xm`r-0StoRbs`qhof-0mhoj^q`xm`r","timeslice_heartbeat_config":{"pollIntervalMs":33,"idleGapThresholdMs":60,"ignoredTimesliceNames":{"requestAnimationFrame":true,"Event listenHandler mousemove":true,"Event listenHandler mouseover":true,"Event listenHandler mouseout":true,"Event listenHandler scroll":true},"enableOnRequire":true},"shouldLogCounters":false,"timeslice_categories":{"react_render":true,"reflow":true}}); script> style> style>
It's linked to a virus hacker on Facebook, sending videos to all the friends of the person who's been hacked. If you open such a video, you too become hacked and all your friends get the video too. Do not open any suspect videos or messages, particularly in Messenger.
I've written an AngularJS app but it's proving a bit of a nightmare to debug. I'm using Grunt + uglify to concatenate and minify my application code. It also creates a source map alongside the minified JS file.
The source map seems to work properly when there is a JS error in the file, but outside of the AngularJS application. e.g. If I write console.log('a.b'); at the top of one of the files, the error logged in the Chrome debugger displays line + file info for the original file, not the minified one.
The problem occurs when there is a problem with code that Angular runs itself (e.g. in Controller code). I get a nice stack trace from Angular, but it only details the minified file not the original.
Is there anything I can do to get Angular to acknowledge the source map?
Example error below:
TypeError: Cannot call method 'getElement' of undefined
at Object.addMapControls (http://my-site/wp-content/plugins/my-maps/assets/js/app.min.js:1:2848)
at Object.g [as init] (http://my-site/wp-content/plugins/my-maps/assets/js/app.min.js:1:344)
at new a (http://my-site/wp-content/plugins/my-maps/assets/js/app.min.js:1:591)
at d (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js:29:495)
at Object.instantiate (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js:30:123)
Larrifax's answer is good but there is an improved version of the function documented in the same issue report:
.config(function($provide) {
// Fix sourcemaps
// #url https://github.com/angular/angular.js/issues/5217#issuecomment-50993513
$provide.decorator('$exceptionHandler', function($delegate) {
return function(exception, cause) {
$delegate(exception, cause);
setTimeout(function() {
throw exception;
});
};
});
})
This will generate two stack traces, as Andrew Magee noted: one formatted by Angular, then a second one formatted by the browser. The second trace will apply sourcemaps. It's probably not a great idea to disable the duplicates, because you may have other Angular modules that also do work with exceptions that could be called after this via the delegation.
The only solution I could find is to bite the bullet and parse the source maps yourself. Here is some code that will do this. First you need to add source-map to your page. Then add this code:
angular.module('Shared').factory('$exceptionHandler',
function($log, $window, $injector) {
var getSourceMappedStackTrace = function(exception) {
var $q = $injector.get('$q'),
$http = $injector.get('$http'),
SMConsumer = window.sourceMap.SourceMapConsumer,
cache = {};
// Retrieve a SourceMap object for a minified script URL
var getMapForScript = function(url) {
if (cache[url]) {
return cache[url];
} else {
var promise = $http.get(url).then(function(response) {
var m = response.data.match(/\/\/# sourceMappingURL=(.+\.map)/);
if (m) {
var path = url.match(/^(.+)\/[^/]+$/);
path = path && path[1];
return $http.get(path + '/' + m[1]).then(function(response) {
return new SMConsumer(response.data);
});
} else {
return $q.reject();
}
});
cache[url] = promise;
return promise;
}
};
if (exception.stack) { // not all browsers support stack traces
return $q.all(_.map(exception.stack.split(/\n/), function(stackLine) {
var match = stackLine.match(/^(.+)(http.+):(\d+):(\d+)/);
if (match) {
var prefix = match[1], url = match[2], line = match[3], col = match[4];
return getMapForScript(url).then(function(map) {
var pos = map.originalPositionFor({
line: parseInt(line, 10),
column: parseInt(col, 10)
});
var mangledName = prefix.match(/\s*(at)?\s*(.*?)\s*(\(|#)/);
mangledName = (mangledName && mangledName[2]) || '';
return ' at ' + (pos.name ? pos.name : mangledName) + ' ' +
$window.location.origin + pos.source + ':' + pos.line + ':' +
pos.column;
}, function() {
return stackLine;
});
} else {
return $q.when(stackLine);
}
})).then(function (lines) {
return lines.join('\n');
});
} else {
return $q.when('');
}
};
return function(exception) {
getSourceMappedStackTrace(exception).then($log.error);
};
});
This code will download the source, then download the sourcemaps, parse them, and finally attempt to replace the locations in the stack trace the mapped locations. This works perfectly in Chrome, and quite acceptably in Firefox. The disadvantage is that you are adding a fairly large dependency to your code base and that you move from very fast synchronous error reporting to fairly slow async error reporting.
I just had the same issue and have been hunting around for a solution - apparently it's a Chrome issue with stack traces in general and happens to apply to Angular because it uses stack traces in error reporting. See:
Will the source mapping in Google Chrome push to Error.stack
I would take a look at the following project: https://github.com/novocaine/sourcemapped-stacktrace
It does essentially the same thing as the answer from #jakub-hampl but might be useful.
According to this issue it seems that Angular's $logProvider breaks sourcemapping. A workaround like this is suggested in the issue:
var module = angular.module('source-map-exception-handler', [])
module.config(function($provide) {
$provide.decorator('$exceptionHandler', function($delegate) {
return function(exception, cause) {
$delegate(exception, cause);
throw exception;
};
});
});
As the bug has been fixed in Chrome (but the issue persists in Angular), a workaround that doesn’t print out the stack trace twice would be this:
app.factory('$exceptionHandler', function() {
return function(exception, cause) {
console.error(exception.stack);
};
});
On the script below, IE9 is throwing an error:
SCRIPT5022: DOM Exception: INVALID_CHARACTER_ERR (5)
mootools-1.2.1-core-yc.js, line 118 character 1
Document.implement({
newElement: function (A, B) {
if (Browser.Engine.trident && B) {
["name", "type", "checked"].each(function (C) {
if (!B[C]) {
return;
}
A += " " + C + '="' + B[C] + '"';
if (C != "checked") {
delete B[C];
}
});
A = "<" + A + ">";
}
return $.element(this.createElement(A)).set(B); //THIS IS LINE 118
},
newTextNode: function (A) {
return this.createTextNode(A);
},
getDocument: function () {
return this;
},
getWindow: function () {
return this.window;
}
});
This snippet is part of the Mootools js library that the developer used on the site. Is there a workaround to fix the error for IE?
yeah that code is garbage, you should never do browser checks like that, its taught in JavaScript 101... lol can't believe that's in mootools? blech, anyways
IE9 doesn't allow for crazy document.createElement('<div style="background:red">yay!</div>'); syntax anymore (no one should've ever really been using it in the first place...)
here's an example:
var d = document;
var x = d.createElement('div');
x.innerHTML = 'yay';
x.style.backgroundColor = 'red';
x.style.padding = '6px';
x.style.margin = '20px';
d.body.appendChild(x);
var sameHTML = '<div style="background:green;padding:6px;margin:20px;">yay!</div>';
// fails in IE > 8 and other browsers
try {
var y = d.createElement(sameHTML);
d.body.appendChild(y);
} catch (err) {
d.body.appendChild(d.createTextNode(err));
}
// quick fix using innerHTML:
var temp = d.createElement('div');
temp.innerHTML = sameHTML;
d.body.appendChild(temp.childNodes[0]);
the way to fix this is to either create a dummy element and use .innerHTML and then extract the child, or inside mootools check the browser version and don't do that for IE > 8 if i remember right mootools has a Browser.Engine.version or something to that effect...
edit: i feel like i should also add that this: Browser.Engine.trident is the problematic check, and from the gyst of the code looks like it might occur else where too...
aha! another update:
i found this while looking through [an old] support thread:
you'll need to update to 1.2.5 or 1.3. Previous MooTools versions are not supported by IE9.
so an update to the script should fix your problem, hopefully it won't introduce more bugs... you can get it here: http://mootools.net/download, you might want to try that 1.2.5 version at the top of the page since it will have the least amount of changes...
good luck -ck
I'm doing some optimisation on a site Ive recently taken over. I've found a script I don't recognise:
http://static.ak.fbcdn.net/rsrc.php/zo/r/V95Lkt_uLNB.js
It could be a facebook thing, and there's some key logging going on (that Im not too keen on)
It is without a doubt the largest file being requested on a page load (87kb) so if I can do without it, it'll really speed up the page load.
Does anyone know:
A) What it is
B) What it's for
C) What it does
D) Can I do without it
Okay so I had a look over the beautified version of this minified code and have noted the following:
By itself these are a bunch of utility functions.
CavalryLogger doesn't do anything with this file by itself because it doesn't exist, nor is it defined.
The code in question regarding key binding:
function KeyEventController() {
copy_properties(this, {
handlers: {}
});
document.onkeyup = this.onkeyevent.bind(this, 'onkeyup');
document.onkeydown = this.onkeyevent.bind(this, 'onkeydown');
document.onkeypress = this.onkeyevent.bind(this, 'onkeypress');
}
copy_properties(KeyEventController, {
instance: null,
getInstance: function () {
return KeyEventController.instance || (KeyEventController.instance = new KeyEventController());
},
defaultFilter: function (event, a) {
event = $E(event);
return KeyEventController.filterEventTypes(event, a) && KeyEventController.filterEventTargets(event, a) && KeyEventController.filterEventModifiers(event, a);
},
filterEventTypes: function (event, a) {
if (a === 'onkeydown') return true;
return false;
},
filterEventTargets: function (event, b) {
var a = $E(event).getTarget();
if (DOM.isNode(a, ['input', 'select', 'textarea', 'object', 'embed'])) if (a.type != 'checkbox' && a.type != 'radio' && a.type != 'submit') return false;
return a.getAttribute('contentEditable') != 'true';
},
filterEventModifiers: function (event, a) {
if (event.ctrlKey || event.altKey || event.metaKey || event.repeat) return false;
return true;
},
registerKey: function (f, a, d, g) {
if (d === undefined) d = KeyEventController.defaultFilter;
var b = KeyEventController.getInstance();
var c = b.mapKey(f);
if (is_empty(b.handlers)) onleaveRegister(b.resetHandlers.bind(b));
for (var e = 0; e < c.length; e++) {
f = c[e];
if (!b.handlers[f] || g) b.handlers[f] = [];
b.handlers[f].push({
callback: a,
filter: d
});
}
},
keyCodeMap: {
'[': [219],
']': [221],
'`': [192],
LEFT: [KEYS.LEFT, 63234],
RIGHT: [KEYS.RIGHT, 63235],
RETURN: [KEYS.RETURN],
TAB: [KEYS.TAB],
DOWN: [KEYS.DOWN, 63233],
UP: [KEYS.UP, 63232],
ESCAPE: [KEYS.ESC],
BACKSPACE: [KEYS.BACKSPACE],
DELETE: [KEYS.DELETE]
}
});
copy_properties(KeyEventController.prototype, {
mapKey: function (a) {
if (typeof (a) == 'number') return [48 + a, 96 + a];
if (KeyEventController.keyCodeMap[a.toUpperCase()]) return KeyEventController.keyCodeMap[a.toUpperCase()];
var b = a.toUpperCase().charCodeAt(0);
return [b];
},
onkeyevent: function (i, c) {
c = $E(c);
var d = null;
var g = this.handlers[c.keyCode];
var b, f, a;
if (g) for (var h = 0; h < g.length; h++) {
b = g[h].callback;
f = g[h].filter;
try {
if (!f || f(c, i)) {
var node = null;
if (window.Parent && Parent.byTag && c.getTarget) node = Parent.byTag(c.getTarget(), 'a');
user_action(node, 'key', c);
a = b(c, i);
if (a === false) return Event.kill(c);
}
} catch (e) {}
}
return true;
},
resetHandlers: function () {
this.handlers = {};
}
});
This code lets you bind keys to callbacks, and includes more human readable names for common keys. Take for example the usage here:
KeyEventController.registerKey('ESCAPE', Dialog._handleEscapeKey, a);
The ESCAPE key is registered to make Dialogs go away. handlers is also empty by default, so nothing is going to happen until you use registerKey or append to it manually. Note that this is the only instance of registerKey being called.
It also has a lot of AJAX utility functions. Can't really send anything to Facebook from your domain anyways because of same origin policy (unless you modified security permissions, but then that's your fault). Same thing with the cookies set.
There's also a history manger, but it uses an iFrame so it won't be able to read it from your domain anyways.
Finally the like button code I found is an iFrame, so it wouldn't need JS includes unless you were using javascript to create the iFrame or something.
With that in mind I don't see the need for you to include all this.
It looks like this is directly connected to having the "Like this" functionality on a page. The iframe you use to include the 'Like' button seems to come with a couple of 'bonus' scripts.
If you ask me, this is another good reason to NOT have Facebook integrated, it appears to be logging keypresses, and that is not cool.
A quick google search doesn't provide alot of answers - it's some sort of event tracking script for Facebook, and I saw a tweet and a couple of forum posts where people mentioned disabling it and gaining a speed boost - I think you can safely get rid of it, atleast it's worth giving it a try.
This is definitely from Facebook - one of many supporting files for FBML / API / etc.
If you are not using any FB features in your project, simply remove this file.
If you are using any FB features (like 'Like' button), you shouldn't use this file (or any other files with cryptic names) directly either.
You should instead
1) create empty <div id="fb-root"></div> somewhere at the end f your page
2) include http://connect.facebook.net/en_US/all.js script in your page
3) follow further instructions from http://developers.facebook.com/
When the IFRAME is loaded it calls the following URI:
https://www.facebook.com/plugins/like.php?api_key=[your_api_key]&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D27%23cb%3Df39f390d40f7332%26domain%3D[your_TLD]%26origin%3Dhttp%253A%252F%252F[your_TLD]%252Ff72f1f9bea899e%26relation%3Dparent.parent&colorscheme=light&extended_social_context=false&href=[your_share_URI]&layout=button_count&locale=en_US&node_type=link&sdk=joey&send=false&show_faces=false&width=100
Within the script tags of this page are the following calls.
PluginAsyncLoader.load("**https:\/\/fbstatic-a.akamaihd.net\/rsrc.php\/v2\/yq\/r\/CNRdIwfy3yI.js**");
PluginAsyncLoader.ondemandjs = "**https:\/\/fbstatic-a.akamaihd.net\/rsrc.php\/v2\/yH\/r\/muz85bheueJ.js**";
I found "calverly logger" in a file that I did not download but I saw it download right in front of me when I closed Thunderbird (was running Firefox behind it and it showed up there as a file downloading) so went to check what it was.
The file was called: "See All.html" which I found odd and worrying.
the head of the file contains the following code indicating it is a Facebook function...
The Calvery Logger is mentioned near the bottom of the file (not shown here). I have stripped out the html < near the head of the file so that you can see the code... Not sure it will help but look forward to any insights...
// !DOCTYPE html
html lang="en" id="facebook" class="no_js"
head
meta charset="utf-8" />
meta name="referrer" content="origin-when-crossorigin" id="meta_referrer" />
script> window._cstart=+new Date();</script><script>function envFlush(a) {function b(c){for(var d in a)c[d]=a[d];}if(window.requireLazy){window.requireLazy(['Env'],b);}else{window.Env=window.Env||{};b(window.Env);}}envFlush({"ajaxpipe_token":"AXiYOZarFarwOff3","lhsh":"AAQFK_mp-","khsh":"0`sj`e`rm`s-0fdu^gshdoer-0gc^eurf-3gc^eurf;1;enbtldou;fduDmdldourCxO`ld-2YLMIuuqSdptdru;qsnunuxqd;rdoe-0unjdojnx-0unjdojnx0-0gdubi^rdbsduOdv-0`sj`e`r-0q`xm`r-0StoRbs`qhof-0mhoj^q`xm`r","timeslice_heartbeat_config":{"pollIntervalMs":33,"idleGapThresholdMs":60,"ignoredTimesliceNames":{"requestAnimationFrame":true,"Event listenHandler mousemove":true,"Event listenHandler mouseover":true,"Event listenHandler mouseout":true,"Event listenHandler scroll":true},"enableOnRequire":true},"shouldLogCounters":false,"timeslice_categories":{"react_render":true,"reflow":true}}); script> style> style>
It's linked to a virus hacker on Facebook, sending videos to all the friends of the person who's been hacked. If you open such a video, you too become hacked and all your friends get the video too. Do not open any suspect videos or messages, particularly in Messenger.