mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Merge branch 'ent-6399-no-funciona-extension-de-chrome' into 'develop'
fixes chrome extension credentials using POST instead GET See merge request artica/pandorafms!3514
This commit is contained in:
commit
ff2f7c32f0
@ -3,7 +3,7 @@ var isFetching = null;
|
|||||||
var storedEvents = new Array();
|
var storedEvents = new Array();
|
||||||
var notVisited = {};
|
var notVisited = {};
|
||||||
|
|
||||||
$(window).on('load', function() {
|
$(window).on("load", function() {
|
||||||
initilise();
|
initilise();
|
||||||
// Wait some ms to throw main function
|
// Wait some ms to throw main function
|
||||||
var delay = setTimeout(main, 100);
|
var delay = setTimeout(main, 100);
|
||||||
@ -23,20 +23,27 @@ function removeNotVisited(eventId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
|
||||||
chrome.runtime.sendMessage({ text: "FETCH_EVENTS" });
|
chrome.runtime.sendMessage({ text: "FETCH_EVENTS" });
|
||||||
// Do not fetch if is fetching now
|
// Do not fetch if is fetching now
|
||||||
if (isFetching) return;
|
if (isFetching) return;
|
||||||
isFetching = true;
|
isFetching = true;
|
||||||
|
|
||||||
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=json&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
|
var url =
|
||||||
|
localStorage["ip_address"] +
|
||||||
|
"/include/api.php?op=get&op2=events&return_type=json";
|
||||||
|
var feedUrl = url;
|
||||||
|
var data = new FormData();
|
||||||
|
|
||||||
|
data.append("apipass", localStorage["api_pass"]);
|
||||||
|
data.append("user", localStorage["user_name"]);
|
||||||
|
data.append("pass", localStorage["pass"]);
|
||||||
|
|
||||||
req = new XMLHttpRequest();
|
req = new XMLHttpRequest();
|
||||||
req.onload = handleResponse;
|
req.onload = handleResponse;
|
||||||
req.onerror = handleError;
|
req.onerror = handleError;
|
||||||
req.open("GET", feedUrl, true);
|
req.open("POST", feedUrl, true);
|
||||||
req.withCredentials = true
|
req.withCredentials = true;
|
||||||
req.send(null);
|
req.send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleError() {
|
function handleError() {
|
||||||
@ -64,7 +71,7 @@ function getEvents(reply){
|
|||||||
var fetchedEvents = parseReplyEvents(reply);
|
var fetchedEvents = parseReplyEvents(reply);
|
||||||
|
|
||||||
// If there is no events requested, mark all as visited
|
// If there is no events requested, mark all as visited
|
||||||
if (storedEvents.length == 0) {
|
if (typeof storedEvents != "undefined" && storedEvents.length == 0) {
|
||||||
notVisited = {};
|
notVisited = {};
|
||||||
storedEvents = fetchedEvents;
|
storedEvents = fetchedEvents;
|
||||||
return;
|
return;
|
||||||
@ -78,10 +85,10 @@ function getEvents(reply){
|
|||||||
// Check if popup is displayed to make some actions
|
// Check if popup is displayed to make some actions
|
||||||
var views = chrome.extension.getViews({ type: "popup" });
|
var views = chrome.extension.getViews({ type: "popup" });
|
||||||
for (var k = 0; k < newEvents.length; k++) {
|
for (var k = 0; k < newEvents.length; k++) {
|
||||||
newNotVisited[newEvents[k]['id']] = true;
|
newNotVisited[newEvents[k]["id"]] = true;
|
||||||
if (views.length == 0) {
|
if (views.length == 0) {
|
||||||
notVisitedCount++;
|
notVisitedCount++;
|
||||||
displayNotification (newEvents[k])
|
displayNotification(newEvents[k]);
|
||||||
alertsSound(newEvents[k]);
|
alertsSound(newEvents[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,15 +96,15 @@ function getEvents(reply){
|
|||||||
// Make that the old events marked as not visited remains with the
|
// Make that the old events marked as not visited remains with the
|
||||||
// same status
|
// same status
|
||||||
for (var k = 0; k < fetchedEvents.length; k++) {
|
for (var k = 0; k < fetchedEvents.length; k++) {
|
||||||
if (notVisited[fetchedEvents[k]['id']] === true) {
|
if (notVisited[fetchedEvents[k]["id"]] === true) {
|
||||||
newNotVisited[fetchedEvents[k]['id']] = true;
|
newNotVisited[fetchedEvents[k]["id"]] = true;
|
||||||
notVisitedCount++;
|
notVisitedCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notVisited = newNotVisited;
|
notVisited = newNotVisited;
|
||||||
|
|
||||||
// Update the number
|
// Update the number
|
||||||
localStorage["new_events"] = (views.length == 0) ? notVisitedCount : 0;
|
localStorage["new_events"] = views.length == 0 ? notVisitedCount : 0;
|
||||||
updateBadge();
|
updateBadge();
|
||||||
|
|
||||||
// Store the requested events
|
// Store the requested events
|
||||||
@ -118,7 +125,7 @@ function fetchNewEvents(A,B){
|
|||||||
for (var i = 0; i < A.length; i++) {
|
for (var i = 0; i < A.length; i++) {
|
||||||
var id = false;
|
var id = false;
|
||||||
for (var j = 0; j < B.length; j++) {
|
for (var j = 0; j < B.length; j++) {
|
||||||
if(A[i]['id'] == B[j]['id']) {
|
if (A[i]["id"] == B[j]["id"]) {
|
||||||
id = true;
|
id = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -130,11 +137,15 @@ function fetchNewEvents(A,B){
|
|||||||
return arrDiff;
|
return arrDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function parseReplyEvents(reply) {
|
function parseReplyEvents(reply) {
|
||||||
|
|
||||||
// Split the API response
|
// Split the API response
|
||||||
var data = JSON.parse(reply)
|
var data;
|
||||||
|
try {
|
||||||
|
data = JSON.parse(reply);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
var e_array = JSON.parse(reply).data;
|
var e_array = JSON.parse(reply).data;
|
||||||
|
|
||||||
// Form a properly object
|
// Form a properly object
|
||||||
@ -142,16 +153,16 @@ function parseReplyEvents (reply) {
|
|||||||
for (var i = 0; i < e_array.length; i++) {
|
for (var i = 0; i < e_array.length; i++) {
|
||||||
var event = e_array[i];
|
var event = e_array[i];
|
||||||
fetchedEvents.push({
|
fetchedEvents.push({
|
||||||
'id' : event.id_evento,
|
id: event.id_evento,
|
||||||
'agent_name' : event.agent_name,
|
agent_name: event.agent_name,
|
||||||
'agent' : event.id_agente,
|
agent: event.id_agente,
|
||||||
'date' : event.timestamp,
|
date: event.timestamp,
|
||||||
'title' : event.evento,
|
title: event.evento,
|
||||||
'module' : event.id_agentmodule,
|
module: event.id_agentmodule,
|
||||||
'type' : event.event_type,
|
type: event.event_type,
|
||||||
'source' : event.source,
|
source: event.source,
|
||||||
'severity' : event.criticity_name,
|
severity: event.criticity_name,
|
||||||
'visited' : false
|
visited: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Return the events
|
// Return the events
|
||||||
@ -163,7 +174,7 @@ function alertsSound(pEvent){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pEvent['severity']) {
|
switch (pEvent["severity"]) {
|
||||||
case "Critical":
|
case "Critical":
|
||||||
playSound(localStorage["critical"]);
|
playSound(localStorage["critical"]);
|
||||||
break;
|
break;
|
||||||
@ -183,7 +194,6 @@ function alertsSound(pEvent){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function displayNotification(pEvent) {
|
function displayNotification(pEvent) {
|
||||||
|
|
||||||
// Check if the user is okay to get some notification
|
// Check if the user is okay to get some notification
|
||||||
if (Notification.permission === "granted") {
|
if (Notification.permission === "granted") {
|
||||||
// If it's okay create a notification
|
// If it's okay create a notification
|
||||||
@ -193,10 +203,10 @@ function displayNotification (pEvent) {
|
|||||||
// Otherwise, we need to ask the user for permission
|
// Otherwise, we need to ask the user for permission
|
||||||
// Note, Chrome does not implement the permission static property
|
// Note, Chrome does not implement the permission static property
|
||||||
// So we have to check for NOT 'denied' instead of 'default'
|
// So we have to check for NOT 'denied' instead of 'default'
|
||||||
else if (Notification.permission !== 'denied') {
|
else if (Notification.permission !== "denied") {
|
||||||
Notification.requestPermission(function(permission) {
|
Notification.requestPermission(function(permission) {
|
||||||
// Whatever the user answers, we make sure we store the information
|
// Whatever the user answers, we make sure we store the information
|
||||||
if(!('permission' in Notification)) {
|
if (!("permission" in Notification)) {
|
||||||
Notification.permission = permission;
|
Notification.permission = permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,34 +217,37 @@ function displayNotification (pEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNotification(pEvent) {
|
function getNotification(pEvent) {
|
||||||
|
|
||||||
// Build the event text
|
// Build the event text
|
||||||
var even = pEvent['type'];
|
var even = pEvent["type"];
|
||||||
if (pEvent['source'] != '') even += " : " + pEvent['source'];
|
if (pEvent["source"] != "") even += " : " + pEvent["source"];
|
||||||
even += ". Event occured at " + pEvent['date'];
|
even += ". Event occured at " + pEvent["date"];
|
||||||
if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module'];
|
if (pEvent["module"] != 0)
|
||||||
|
even += " in the module with Id " + pEvent["module"];
|
||||||
even += ".";
|
even += ".";
|
||||||
|
|
||||||
var url = (pEvent['agent'] == 0)
|
var url =
|
||||||
? localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events"
|
pEvent["agent"] == 0
|
||||||
: localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + pEvent['agent'];
|
? localStorage["ip_address"] +
|
||||||
|
"/index.php?sec=eventos&sec2=operation/events/events"
|
||||||
|
: localStorage["ip_address"] +
|
||||||
|
"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" +
|
||||||
|
pEvent["agent"];
|
||||||
|
|
||||||
var notification = new Notification(
|
var notification = new Notification(pEvent["title"], {
|
||||||
pEvent['title'],
|
|
||||||
{
|
|
||||||
body: even,
|
body: even,
|
||||||
icon: "images/icon.png"
|
icon: "images/icon.png"
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Add the link
|
// Add the link
|
||||||
notification.onclick = function(event) {
|
notification.onclick = function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
window.open(url, '_blank');
|
window.open(url, "_blank");
|
||||||
}
|
};
|
||||||
|
|
||||||
// Close notification after 10 secs
|
// Close notification after 10 secs
|
||||||
setTimeout(function() {notification.close()}, 10000);
|
setTimeout(function() {
|
||||||
|
notification.close();
|
||||||
|
}, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetInterval() {
|
function resetInterval() {
|
||||||
@ -243,7 +256,6 @@ function resetInterval () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initilise() {
|
function initilise() {
|
||||||
|
|
||||||
if (isFetching == null) isFetching = false;
|
if (isFetching == null) isFetching = false;
|
||||||
if (localStorage["ip_address"] == undefined) {
|
if (localStorage["ip_address"] == undefined) {
|
||||||
localStorage["ip_address"] = "http://firefly.artica.es/pandora_demo";
|
localStorage["ip_address"] = "http://firefly.artica.es/pandora_demo";
|
||||||
|
@ -8,7 +8,10 @@ $(document).ready(function() {
|
|||||||
bg = chrome.extension.getBackgroundPage();
|
bg = chrome.extension.getBackgroundPage();
|
||||||
|
|
||||||
// Display the information
|
// Display the information
|
||||||
if (bg.fetchEvents().length == 0) {
|
var events = bg.fetchEvents();
|
||||||
|
if (!events) {
|
||||||
|
showError("Failed to retrieve events, please retry");
|
||||||
|
} else if (events.length == 0) {
|
||||||
showError("No events");
|
showError("No events");
|
||||||
} else {
|
} else {
|
||||||
showEvents();
|
showEvents();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_name__",
|
"name": "__MSG_name__",
|
||||||
"version": "2.2",
|
"version": "2.3",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Pandora FMS Event viewer Chrome extension",
|
"description": "Pandora FMS Event viewer Chrome extension",
|
||||||
"homepage_url": "http://pandorafms.com",
|
"homepage_url": "http://pandorafms.com",
|
||||||
|
@ -1,32 +1,38 @@
|
|||||||
if ("undefined" == typeof(PandoraChrome)) {
|
/* globals Components, req */
|
||||||
|
if ("undefined" == typeof PandoraChrome) {
|
||||||
var PandoraChrome = {};
|
var PandoraChrome = {};
|
||||||
var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("pandora.");
|
var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPrefService)
|
||||||
|
.getBranch("pandora.");
|
||||||
|
|
||||||
var timer = null;
|
var timer = null;
|
||||||
var allEvents = new Array();
|
var allEvents = new Array();
|
||||||
var newEvents = new Array();
|
var newEvents = new Array();
|
||||||
var oldEvents = new Array();
|
var oldEvents = new Array();
|
||||||
var api_div_numbers = 21;
|
var api_div_numbers = 21;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
PandoraChrome.fn = (function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PandoraChrome.fn = function(){
|
|
||||||
return {
|
return {
|
||||||
displaySideBar: function() {
|
displaySideBar: function() {
|
||||||
PandoraChrome.fn.hideNotification();
|
PandoraChrome.fn.hideNotification();
|
||||||
PandoraChrome.fn.hideBadge();
|
PandoraChrome.fn.hideBadge();
|
||||||
toggleSidebar('viewPandoraSidebar');
|
toggleSidebar("viewPandoraSidebar");
|
||||||
},
|
},
|
||||||
displayDialog: function() {
|
displayDialog: function() {
|
||||||
window.openDialog("chrome://pandorasidebar/content/options.xul", "","chrome, centerscreen, dialog, modal, resizable=no", null).focus();
|
window
|
||||||
|
.openDialog(
|
||||||
|
"chrome://pandorasidebar/content/options.xul",
|
||||||
|
"",
|
||||||
|
"chrome, centerscreen, dialog, modal, resizable=no",
|
||||||
|
null
|
||||||
|
)
|
||||||
|
.focus();
|
||||||
},
|
},
|
||||||
handleClick: function(e) {
|
handleClick: function(e) {
|
||||||
if (e.button == 0) {
|
if (e.button == 0) {
|
||||||
toggleSidebar('viewPandoraSidebar');
|
toggleSidebar("viewPandoraSidebar");
|
||||||
PandoraChrome.fn.setIcon('icon16');
|
PandoraChrome.fn.setIcon("icon16");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -42,18 +48,24 @@ PandoraChrome.fn = function(){
|
|||||||
timer = setTimeout(PandoraChrome.fn.main, 100);
|
timer = setTimeout(PandoraChrome.fn.main, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
main: function() {
|
main: function() {
|
||||||
// alert('test_main');
|
// alert('test_main');
|
||||||
var url=prefManager.getCharPref("ip_address")+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+prefManager.getCharPref("api_pass")+'&user='+prefManager.getCharPref("user_name")+'&pass='+prefManager.getCharPref("pass");
|
var url =
|
||||||
|
prefManager.getCharPref("ip_address") +
|
||||||
|
"/include/api.php?op=get&op2=events&return_type=json";
|
||||||
var feedUrl = url;
|
var feedUrl = url;
|
||||||
|
var data = new FormData();
|
||||||
|
|
||||||
|
data.append("apipass", prefManager.getCharPref("api_pass"));
|
||||||
|
data.append("user", prefManager.getCharPref("user_name"));
|
||||||
|
data.append("pass", prefManager.getCharPref("pass"));
|
||||||
|
|
||||||
prefManager.setBoolPref("data_check", true);
|
prefManager.setBoolPref("data_check", true);
|
||||||
req = new XMLHttpRequest();
|
req = new XMLHttpRequest();
|
||||||
req.onload = PandoraChrome.fn.handleResponse;
|
req.onload = PandoraChrome.fn.handleResponse;
|
||||||
req.onerror = PandoraChrome.fn.handleError;
|
req.onerror = PandoraChrome.fn.handleError;
|
||||||
req.open("GET", feedUrl, true);
|
req.open("POST", feedUrl, true);
|
||||||
req.send(null);
|
req.send(data);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleError: function() {
|
handleError: function() {
|
||||||
@ -75,21 +87,16 @@ PandoraChrome.fn = function(){
|
|||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
}
|
||||||
timer = setTimeout(PandoraChrome.fn.main, 1000);
|
timer = setTimeout(PandoraChrome.fn.main, 1000);
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else{
|
|
||||||
var n = doc.search("404 Not Found");
|
var n = doc.search("404 Not Found");
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
|
|
||||||
prefManager.setCharPref("data", null);
|
prefManager.setCharPref("data", null);
|
||||||
prefManager.setBoolPref("data_check", false);
|
prefManager.setBoolPref("data_check", false);
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
}
|
||||||
timer = setTimeout(PandoraChrome.fn.main, 1000);
|
timer = setTimeout(PandoraChrome.fn.main, 1000);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else{
|
|
||||||
prefManager.setBoolPref("data_check", true);
|
prefManager.setBoolPref("data_check", true);
|
||||||
|
|
||||||
prefManager.setCharPref("data", doc);
|
prefManager.setCharPref("data", doc);
|
||||||
@ -106,7 +113,6 @@ PandoraChrome.fn = function(){
|
|||||||
oldEvents = allEvents;
|
oldEvents = allEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
newEvents = PandoraChrome.fn.fetchNewEvents(allEvents, oldEvents);
|
newEvents = PandoraChrome.fn.fetchNewEvents(allEvents, oldEvents);
|
||||||
if (newEvents.length != 0) {
|
if (newEvents.length != 0) {
|
||||||
for (var k = 0; k < newEvents.length; k++) {
|
for (var k = 0; k < newEvents.length; k++) {
|
||||||
@ -114,23 +120,22 @@ PandoraChrome.fn = function(){
|
|||||||
prefManager.setIntPref("new_events", temp);
|
prefManager.setIntPref("new_events", temp);
|
||||||
PandoraChrome.fn.showNotification(k);
|
PandoraChrome.fn.showNotification(k);
|
||||||
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
|
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oldEvents = allEvents;
|
oldEvents = allEvents;
|
||||||
if (prefManager.getIntPref("new_events") > 0) {
|
if (prefManager.getIntPref("new_events") > 0) {
|
||||||
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
|
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
PandoraChrome.fn.hideBadge();
|
PandoraChrome.fn.hideBadge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
}
|
||||||
timer =setTimeout(PandoraChrome.fn.main , prefManager.getIntPref("refresh")*1000 );
|
timer = setTimeout(
|
||||||
|
PandoraChrome.fn.main,
|
||||||
|
prefManager.getIntPref("refresh") * 1000
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -152,44 +157,49 @@ PandoraChrome.fn = function(){
|
|||||||
if (newEvents[eventId][19] == "Warning") {
|
if (newEvents[eventId][19] == "Warning") {
|
||||||
Sounds.playSound(prefManager.getIntPref("warning"));
|
Sounds.playSound(prefManager.getIntPref("warning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var newEve = document.getElementById('newEvent');
|
var newEve = document.getElementById("newEvent");
|
||||||
newEve.label = "Last Event : " + newEvents[eventId][6];
|
newEve.label = "Last Event : " + newEvents[eventId][6];
|
||||||
var id;
|
var id;
|
||||||
if (newEvents[eventId][9] == 0) {
|
if (newEvents[eventId][9] == 0) {
|
||||||
id = ".";
|
id = ".";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
id = " in the module with Id " + newEvents[eventId][9] + ".";
|
id = " in the module with Id " + newEvents[eventId][9] + ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
|
var event =
|
||||||
|
newEvents[eventId][14] +
|
||||||
|
" : " +
|
||||||
|
newEvents[eventId][17] +
|
||||||
|
". Event occured at " +
|
||||||
|
newEvents[eventId][5] +
|
||||||
|
id;
|
||||||
newEve.tooltipText = event;
|
newEve.tooltipText = event;
|
||||||
$('#newEvent').show();
|
$("#newEvent").show();
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
hideNotification: function() {
|
hideNotification: function() {
|
||||||
//alert("Hide Notif");
|
//alert("Hide Notif");
|
||||||
$('#newEvent').hide();
|
$("#newEvent").hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
showBadge: function(txt) {
|
showBadge: function(txt) {
|
||||||
//alert(txt);
|
//alert(txt);
|
||||||
var updateCount = document.getElementById('temp');
|
var updateCount = document.getElementById("temp");
|
||||||
updateCount.setAttribute("style","cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;") ;
|
updateCount.setAttribute(
|
||||||
|
"style",
|
||||||
|
"cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;"
|
||||||
|
);
|
||||||
updateCount.label = txt;
|
updateCount.label = txt;
|
||||||
$('#temp').show();
|
$("#temp").show();
|
||||||
},
|
},
|
||||||
|
|
||||||
hideBadge: function() {
|
hideBadge: function() {
|
||||||
var updateCount = document.getElementById('temp');
|
var updateCount = document.getElementById("temp");
|
||||||
//alert("hide B");
|
//alert("hide B");
|
||||||
$('#temp').hide();
|
$("#temp").hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
divideArray: function(e_array) {
|
divideArray: function(e_array) {
|
||||||
@ -201,7 +211,6 @@ PandoraChrome.fn = function(){
|
|||||||
return Events;
|
return Events;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
fetchNewEvents: function(A, B) {
|
fetchNewEvents: function(A, B) {
|
||||||
var arrDiff = new Array();
|
var arrDiff = new Array();
|
||||||
// alert(A.length);
|
// alert(A.length);
|
||||||
@ -221,25 +230,33 @@ PandoraChrome.fn = function(){
|
|||||||
return arrDiff;
|
return arrDiff;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getNotification: function(eventId) {
|
getNotification: function(eventId) {
|
||||||
var title = newEvents[eventId][6];
|
var title = newEvents[eventId][6];
|
||||||
var id;
|
var id;
|
||||||
if (newEvents[eventId][9] == 0) {
|
if (newEvents[eventId][9] == 0) {
|
||||||
id = ".";
|
id = ".";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
id = " in the module with Id " + newEvents[eventId][9] + ".";
|
id = " in the module with Id " + newEvents[eventId][9] + ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
|
var event =
|
||||||
|
newEvents[eventId][14] +
|
||||||
|
" : " +
|
||||||
|
newEvents[eventId][17] +
|
||||||
|
". Event occured at " +
|
||||||
|
newEvents[eventId][5] +
|
||||||
|
id;
|
||||||
//var event=newEvents[eventId][14]+' '+newEvents[eventId][17]+' Event occured at:'+ newEvents[eventId][5] +'in the module with Id '+ newEvents[eventId][9];
|
//var event=newEvents[eventId][14]+' '+newEvents[eventId][17]+' Event occured at:'+ newEvents[eventId][5] +'in the module with Id '+ newEvents[eventId][9];
|
||||||
return '<a>' + title + '</a> <br/> <span style="font-size:80%">' + event + '</span>';
|
return (
|
||||||
|
"<a>" +
|
||||||
|
title +
|
||||||
|
'</a> <br/> <span style="font-size:80%">' +
|
||||||
|
event +
|
||||||
|
"</span>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}();
|
})();
|
||||||
|
|
||||||
/* Add Event Listener */
|
/* Add Event Listener */
|
||||||
window.addEventListener("load", PandoraChrome.fn.Onloading(), false);
|
window.addEventListener("load", PandoraChrome.fn.Onloading(), false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user