I have a plan to use chrome extensions to do something when a specific js function of web server is called. Here is script of "a.js" from web server. I want to do something when "$.progressHide" function is called. How can I do with background.js or content.js?
[a.js]
(function($) {
var className = 'progressPopup';
$.progressShow = function () {
$(document).progressShow();
};
$.progressHide = function () {
$(document).progressHide();
};
$.fn.progressShow = function () {
var progressClass = this.attr('data-progressClass');
if(progressClass) {
$('.' + progressClass).show();
return;
}
$('body').append(
$('<div></div>').addClass(className).css({
position: 'fixed',
zIndex: 9999999999998,
left: 0, top: 0, right: 0, bottom: 0,
backgroundColor: '#000',
opacity: 0.3,
filter: "alpha(opacity=30)"
})
);
$('body').append(
$('<img src="/content/assets/images/common/img_loading.gif"/>' ).addClass(className).css({
position: 'fixed',
zIndex: 9999999999999,
left: '50%',
top: '50%',
marginLeft: '-200px',
marginTop: '-90px'
})
);
return this;
};
$.fn.progressHide = function () {
var progressClass = this.attr('data-progressClass');
if(progressClass) {
$('.' + progressClass).hide();
return;
}
$('.' + className).remove();
return this;
};}(jQuery));