Skip to content

Instantly share code, notes, and snippets.

@bobvh
Created December 6, 2017 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobvh/7355e498f4dab56e15d3d1f1c0b9b946 to your computer and use it in GitHub Desktop.
Save bobvh/7355e498f4dab56e15d3d1f1c0b9b946 to your computer and use it in GitHub Desktop.
// ==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