Skip to content

Instantly share code, notes, and snippets.

@and-rom
Last active September 7, 2021 18:01
Show Gist options
  • Select an option

  • Save and-rom/8bd98ad2030f6663866e629a89e06b53 to your computer and use it in GitHub Desktop.

Select an option

Save and-rom/8bd98ad2030f6663866e629a89e06b53 to your computer and use it in GitHub Desktop.
AliExpress Order to Clipboard
// ==UserScript==
// @name AliExpress Order to Clipboard
// @namespace https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53
// @version 0.1.7
// @author and-rom
// @description Copy data (order no, dispute date, track no) from order page by pressing Alt+Shift+C
// @homepage https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53
// @icon https://ae01.alicdn.com/images/eng/wholesale/icon/aliexpress.ico
// @icon64 https://ae01.alicdn.com/images/eng/wholesale/icon/aliexpress.ico
// @updateURL https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53/raw/aliorder.meta.js
// @downloadURL https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53/raw/aliorder.user.js
// @match https://*.aliexpress.com/order_detail.htm*
// @grant none
// ==/UserScript==
// ==UserScript==
// @name AliExpress Order to Clipboard
// @namespace https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53
// @version 0.1.7
// @author and-rom
// @description Copy data (order no, dispute date, track no) from order page by pressing Alt+Shift+C
// @homepage https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53
// @icon https://ae01.alicdn.com/images/eng/wholesale/icon/aliexpress.ico
// @icon64 https://ae01.alicdn.com/images/eng/wholesale/icon/aliexpress.ico
// @updateURL https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53/raw/aliorder.meta.js
// @downloadURL https://gist.github.com/and-rom/8bd98ad2030f6663866e629a89e06b53/raw/aliorder.user.js
// @match https://*.aliexpress.com/order_detail.htm*
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.addEventListener('keydown', function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (e.altKey && e.shiftKey && code==67) { //Alt+Shift+c
var obj = new Object();
obj.shop = "AliExpress"
obj.orderNo = document.querySelector("dd.order-no").textContent.trim();
try {
obj.disputeDate = document.querySelectorAll("dd.order-reminder>strong")[1].textContent.trim();
}
catch (e) {
obj.disputeDate = "";
}
obj.trackNo = document.querySelector("table.shipping-table>tbody>tr>td.no").textContent.trim();
var jsonString= JSON.stringify(obj);
console.log(jsonString);
var dummy = document.createElement("input");
document.body.appendChild(dummy);
dummy.setAttribute("id", "dummy_id");
document.getElementById("dummy_id").value=jsonString;
dummy.select();
document.execCommand('copy');
document.body.removeChild(dummy);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment