Last active
September 1, 2016 14:02
-
-
Save rafal83/6dea29d07743a8a7bab091e31e3c9782 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Aliexpress Tracking | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Get Link to 17 Track for all orders | |
| // @match http*://trade.aliexpress.com/* | |
| // @require https://code.jquery.com/jquery-latest.js | |
| // @require https://www.17track.net/externalcall.js | |
| // ==/UserScript== | |
| var listTrack = new Array(); | |
| var totalTrack = 0; | |
| getTrackingNumber = function(data){ | |
| //console.log(data); | |
| console.log(listTrack.length+'/'+totalTrack); | |
| var orderId = data.cainiaoUrl.split('=')[1]; | |
| var trackId = data.tracking[0].mailNo; | |
| var oneUrl = 'https://www.17track.net/fr/track?nums='+trackId; | |
| var statut = data.tracking[0].keyDesc; | |
| listTrack.push(trackId); | |
| if(data.tracking[0].traceList) { | |
| dt = new Date(data.tracking[0].traceList[0].eventTime); | |
| statut += '<br/>'+dt.toLocaleString()+'<br/>'+data.tracking[0].traceList[0].desc; | |
| } | |
| jQuery('.button-logisticsTracking[orderid='+orderId+']').before('<button id="bt_'+orderId+'" style="background-color: red;color: white;font-weight: bold;padding:0px">Suivi 17Track.net<br/>'+data.tracking[0].mailNo+'</button>'); | |
| jQuery('button#bt_'+orderId).click(function() { | |
| jQuery('.jcTrkApiDialog').remove(); | |
| YQV5.trackSingleF2({ | |
| YQ_ElementId:'bt_'+orderId, | |
| YQ_Num:trackId, | |
| YQ_Lang:"fr" | |
| }); | |
| }).before('<span style="color: black;font-weight: bold;font-size: 13px;">'+statut+'</span>'); | |
| if(listTrack.length == totalTrack) { | |
| url = 'https://www.17track.net/fr/track?nums='+listTrack.toString(); | |
| console.log(url); | |
| jQuery('body').append('<button id="AllOn17" style="position: fixed;top: 0px;left: 0px;font-size: 20px;z-index: 9999;background-color: red;color: white;font-weight: bold;padding:5px;">TOUS LES SUIVIS SUR 17Track.net</button>'); | |
| jQuery('#AllOn17').click(function() { | |
| window.open(url); | |
| }); | |
| } | |
| }; | |
| (function() { | |
| 'use strict'; | |
| function getAllTrackingNumber() { | |
| console.log("Search orders"); | |
| listTrack.length=0; | |
| totalTrack = jQuery('.button-logisticsTracking').length; | |
| if(totalTrack > 0) { | |
| console.log("Total "+totalTrack); | |
| jQuery('.button-logisticsTracking').each(function() { | |
| var orderId = jQuery(this).attr('orderid'); | |
| jQuery.ajax({ | |
| url:document.location.protocol+'//ilogisticsaddress.aliexpress.com/ajax_logistics_track.htm?orderId='+orderId+'&callback=getTrackingNumber', | |
| dataType:'jsonp' | |
| }); | |
| }); | |
| } | |
| } | |
| getAllTrackingNumber(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment