12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- (function() {
- //鏀惧叆cdn涓婏紝鐩墠51job鐢ㄦ埛
- String.prototype.trim=function(){
- return this.replace(/(^\s*)|(\s*$)/g, "");
- }
- var _tkd = "_tkd";
- function Tracker() {
- var oThis = this;
- oThis.p = {
- push: function () {
- oThis.handleEvent.apply(oThis, arguments);
- }
- };
- oThis.handle();
- }
- Tracker.prototype = {
- handle:function (){
- var oThis = this;
- try{
- _tracker_ : {
- var tkd = window[_tkd],isArray = false;
- if(tkd) {
- isArray = Object.prototype["toString"].call(Object(tkd)) == "[object Array]";
- if(!isArray){
- break _tracker_;
- }
- //handle event
- for (var x = 0; x < tkd.length; x++) {
- oThis.handleEvent(tkd[x]);
- }
- }
- window[_tkd] = oThis.p;
- }
- }catch(exception){
- }
- },
- handleEvent : function(args){
- switch (args[0]) {
- case "_trackSearch":
- send("search", args[1]);
- break;
- case "_trackPageView":
- send("pageView", args[1]);
- break;
- case "_trackEvent":
- send("event", args[1]);
- break;
- }
- }
- }
-
- //send get request
- function send(logType, params) {
- var win = window;
- var n = '_job_img_' + (+new Date()) + '.r' + Math.floor(Math.random() * 1000),
- img = win[n] = new Image();
- img.onload = img.onerror = function () {
- win[n] = null;
- };
- var q = "https:" == document.location.protocol ? "https:" : "http:";
- img.src = q + "//trace.51jingying.com/logRecord.php?" + params + "&vt=" + new Date().getTime() + "&logType=" + logType;
- }
- new Tracker;
- })();
|