Created
December 6, 2017 15:55
-
-
Save bobvh/7355e498f4dab56e15d3d1f1c0b9b946 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name AliLogin | |
// @version 1 | |
// @include https://login.aliexpress.com/* | |
// @grant none | |
// ==/UserScript== | |
function swapFrame(frameId){ | |
let frameEl = document.getElementById(frameId); | |
if (frameEl!=null ) { | |
// Create <embed> and copy all attributes | |
let embedEl = document.createElement('embed'); | |
for (var att, i = 0, atts = frameEl.attributes, n = atts.length; i < n; i++){ | |
att = atts[i]; | |
embedEl.setAttribute(att.nodeName,att.nodeValue); | |
} | |
// Perform the actual swap | |
frameEl.parentElement.replaceChild(embedEl,frameEl); | |
console.log("GM: swapped iframe for embed."); | |
} else { setTimeout(swapFrame, 100, frameId);} // Recursively run until the iframe has loaded | |
} | |
swapFrame('alibaba-login-box'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment