Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qiansen1386/1fdec0287158189066265ac0c8311d00 to your computer and use it in GitHub Desktop.
Save qiansen1386/1fdec0287158189066265ac0c8311d00 to your computer and use it in GitHub Desktop.
Inject Lo-dash FP/Ramda to browser console

Intro

new version available here

Inject Lodash FP v4/Ramda 0.22 to browser console.
If u prefer bookmarklet, feel free to use any bookmarklet converter you like.
Otherwise, a simple copy-paste in Chrome Console might work too, if the target page is not secured by Tls.
For sake of security, I don't provide any uglified code.
Bookmarklet Crunchinator - ted.mielczarek.org might be helpful.


\( ̄︶ ̄)/ Happy Coding, folks.

Warning

Despite how easy it is, making use of this code is still a injection hack. So it may not work if the owner has specified a more rigorous Content-Security-Policy rule, which can explicitly block this sort of behaviors. I think there maybe Chrome extension which can bypass this though.

Credit

Inspired by spalger/gist:6417923

(function () {
const ld = document.createElement('script');
ld.src = 'https://cdn.jsdelivr.net/g/lodash@4(lodash.min.js+lodash.fp.min.js)';
document.getElementsByTagName('head')[0].appendChild(ld);
const defer = function () {
if (window._) {
var fp = _.noConflict();
} else {
setTimeout(function () {
defer();
}, 50);
}
};
defer();
if (window.fp) console.log("Lodash FP is loaded successfully!");
} ());
(function () {
const ld = document.createElement('script');
ld.src = 'https://cdn.jsdelivr.net/ramda/latest/ramda.min.js';
document.getElementsByTagName('head')[0].appendChild(ld);
const defer = function () {
if (window.R) {
console.log("Ramda is loaded successfully!");
} else {
setTimeout(function () {
defer();
}, 50);
}
};
defer();
} ());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment