I have a javascript code which uses iFrames
to pull the data required. This is made in to a bookmarklet. I wanted to know if it is possible to count how many times this bookmarklet is clicked and if so, how to get the number of clicks in to a file? This is the original code:
javascript:(function () {
if (!$('#OmniBoxDiv').length) {
var strLoad = '<div id="OmniBoxDiv" style="display: block;background-color: gold;font-size: 1.25em;z-index: 1000;position: fixed;width: 96%;padding: 2%; text-align: center">Loading...</div>';
var divLoad = $(strLoad).prependTo('body');
}
if(typeof OmniBox === 'object'){
OmniBox.msg();
return;
}
OmniBox = this;
var FStatus = $('tr:has(td:contains("FStatus")):eq(1)>td:eq(1)').text();
var MStatus = $('tr:has(td:contains("MStatus")):eq(2)>td:eq(1)').text();
var Flink = $('a:contains("F Profile")').attr('href');
this.msg = function(){
'<tr><td></td><td>Fstatus:</td><td>'+FStatus+'</td></tr>'+
'<tr><td>IGC</td><td></td><td></td></tr>'
str = '<table>' + str + '</table><a href="javascript:OmniBox.CloseOmniBox();" style="background-color: darkorange;display: inline-block;padding: 0.5% 1%;cursor: pointer;">Close</a>';
$('#OmniBoxDiv').html(str);
}
};
this.CloseOmniBox = function(){
$('#OmniBoxDiv').remove();
};
var FCheck = false, MCheck = false;
var IFF = $('<iframe>'), IFM = $('<iframe>');
$('body').append(IFF);$('body').append(IFM);$('body');
IFF.attr('id','IFF').css('display','none').attr('src',FLink).on('load',function(){
"code"
},
function(){
FCheck = true;
msg();
});
});
"code"
},
function(){
MCheck = true;
msg();
});
});
});
function whilst (condition, action, final) {
var handle = setInterval(function () {
if (condition()) {
action();
} else {
clearInterval(handle);
final();
}
}, 500);
}
})();