2012-08-17 Hareesan Rajendra <rharishan@gmail.com>

* chrome_extension : Updated Missing files and Folders


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6872 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
rharishan 2012-08-17 04:10:07 +00:00
parent 6122a8acd4
commit 808d420bab
12 changed files with 990 additions and 0 deletions

View File

View File

@ -0,0 +1,13 @@
--------How to Install---------
1. Open GoogleChrome web browser
2. Click on the Settings icon and go to tools and click on the "Extensions" on the drop down menu
3. Then change the brower to developer mode (by enabling the option "Developer Mode")
4. Click on the "Load Unpacked extension" and browse the extracted the folder and click OK
5. Now you got extension running with the "pandora demo" site.
6. Go to options and change the parameters.
Feel free to report the bugs and suggestions :)

View File

@ -0,0 +1,257 @@
<!DOCTYPE html>
<html>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/sound.js"></script>
<script type="text/javascript">
var timer = null;
var allEvents=new Array();
var newEvents=new Array();
var oldEvents=new Array();
var api_div_numbers=21;
$(window).load(function() {
initilise();
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(main , 100 );
});
function fetchEvents(){
return oldEvents;
}
function main() {
var url=localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
var feedUrl = url;
localStorage["data_check"]="true";
req = new XMLHttpRequest();
req.onload = handleResponse;
req.onerror = handleError;
req.open("GET", feedUrl, true);
req.send(null);
}
function handleError() {
localStorage["data_check"]="false";
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(main , 1000);
}
function handleResponse() {
var doc = req.responseText;
if (doc=="auth error") {
localStorage["data_check"]="false";
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(main , 1000);
}
else{
var n=doc.search("404 Not Found");
if(n>0){
localStorage["data_check"]="false";
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(main , 1000);
}
else{
localStorage["data_check"]="true"
getEvents(doc);
}
}
}
function getEvents(reply){
if(check()){
all_event_array=reply.split("\n");
allEvents=divideArray(all_event_array);
if(oldEvents.length==0){
oldEvents=allEvents;
}
newEvents=fetchNewEvents(allEvents,oldEvents);
if(newEvents.length!=0){
for(var k=0;k<newEvents.length;k++){
localStorage["new_events"]++;
showNotification(k);
}
}
oldEvents=allEvents;
if(localStorage["new_events"]!=0){
showBadge(localStorage["new_events"]);
}
else{
hideBadge();
}
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(main , localStorage["refresh"]*1000 );
}
}
function showBadge(txt) {
chrome.browserAction.setBadgeBackgroundColor({color:[0,200,0,255]});
chrome.browserAction.setBadgeText({ text: txt });
}
function hideBadge() {
chrome.browserAction.setBadgeText({ text: "" });
}
function divideArray(e_array){
var Events=new Array();
for(var i=0;i<e_array.length;i++){
var event=e_array[i].split(";");
Events.push(event);
}
return Events;
}
function hideNotification(){
}
function fetchNewEvents(A,B){
var arrDiff = new Array();
for(var i = 0; i < A.length; i++) {
var id = false;
for(var j = 0; j < B.length; j++) {
if(A[i][0] == B[j][0]) {
id = true;
break;
}
}
if(!id) {
arrDiff.push(A[i]);
}
}
return arrDiff;
}
function showNotification(eventId){
var Severity;
if(localStorage["sound_alert"]=="on"){
if(newEvents[eventId][19]=="Critical"){
playSound(localStorage["critical"]);
}
if(newEvents[eventId][19]=="Informational"){
playSound(localStorage["informational"]);
}
if(newEvents[eventId][19]=="Maintenance"){
playSound(localStorage["maintenance"]);
}
if(newEvents[eventId][19]=="Normal"){
playSound(localStorage["normal"]);
}
if(newEvents[eventId][19]=="Warning"){
playSound(localStorage["warning"]);
}
}
var notification = webkitNotifications.createHTMLNotification(
"notification.html?event="+eventId
);
notification.show();
}
function getNotification(eventId){
var title=newEvents[eventId][6];
var id;
if(newEvents[eventId][9]==0){
id=".";
}
else {
id= " in the module with Id "+ newEvents[eventId][9] + ".";
}
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
return '<a>' + title + '</a> <br/> <span style="font-size:80%">' + event + '</span>';
}
function check(){
if (localStorage["data_check"]=="true" && localStorage["ip_address"] != null && localStorage["api_pass"] != null &&localStorage["user_name"]!=null &&localStorage["pass"]!=null && localStorage["ip_address"] != "" && localStorage["api_pass"] != "" &&localStorage["user_name"]!="" &&localStorage["pass"]!=""){
return true;
}
else
return false;
}
function initilise(){
if(localStorage["ip_address"]==undefined){
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
}
if(localStorage["api_pass"]==undefined){
localStorage["api_pass"]="doreik0";
}
if(localStorage["user_name"]==undefined){
localStorage["user_name"]="demo";
}
if(localStorage["pass"]==undefined){
localStorage["pass"]="demo";
}
if(localStorage["critical"]==null){
localStorage["critical"]="11";
}
if(localStorage["informational"]==null){
localStorage["informational"]="1";
}
if(localStorage["maintenance"]==null){
localStorage["maintenance"]="10";
}
if(localStorage["normal"]==null){
localStorage["normal"]="6";
}
if(localStorage["warning"]==null){
localStorage["warning"]="2";
}
if(localStorage["events"]==null){
localStorage["events"]=20;
}
if(localStorage["refresh"]==null){
localStorage["refresh"]="10";
}
if(localStorage["ip_address"]==null){
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
}
if(localStorage["api_pass"]==null){
localStorage["api_pass"]="doreik0";
}
if(localStorage["user_name"]==null){
localStorage["user_name"]="demo";
}
if(localStorage["pass"]==null){
localStorage["pass"]="demo";
}
if(localStorage["sound_alert"]==null){
localStorage["sound_alert"]="on";
}
if(localStorage["changed"]==null){
localStorage["changed"]="false";
}
if(localStorage["new_events"]==null){
localStorage["new_events"]=parseInt(localStorage["events"]);
}
}
</script>
<body>
</body>
</html>

View File

@ -0,0 +1,96 @@
body {
min-width:425px;
min-height:540px;
margin:5px;
font-family:Tahoma, Geneva, Arial;
font-size:10pt;
}
h1 { font-weight: bold; font-size:16px; margin:2px 0px 2px 0px; color:#0068C4; font-family:arial }
h2{
color : blue;
}
p
{
font-family:"Times New Roman";
font-size:20px;
}
a { color: #035BAC; text-decoration:none; }
a:hover { text-decoration:underline; }
a:visited { color: #035BAC; text-decoration:none; }
a:visited:hover { text-decoration:underline; }
span.res { font-size:80%; color:#555; }
img.pm { margin-right:3px;cursor:pointer; margin-top:0px; }
div.main{
background-color : white;
height: 500px;
width: 400px;
}
div.textarea{
background-color : #D5DED5;
width :100%
}
div.e{ text-align:right; font-size:8pt; }
div.b { background-color:white; border:1px solid #BABABA; margin:5px; padding:4px; display:none; }
div.b p a { font-size: 10pt; }
div.b p { margin:2px 0px 4px 0px; display:none; color:#333; font-size:9pt; }
div.b div.items p {
margin:2px 0px 8px 0px; color:#333; width:355px;float:left;display:block;
}
div.b div.items p img {
float:left;margin:0px 3px 0px 0px;
}
div.options_header{
height :80px;
width : 450px;
margin : 10px 10px;
}
div.options_divider{
width : 100%;
background-color : #C8D8E8;
}
div.optionsG_textarea{
background-color : green;
width : 450px;
margin : 5px, 10px;
}
div.options_textarea{
background-color : #E1EDE5;
width : 450px;
margin : 10px 10px;
}
.tooltip {
display:none;
font-size:12px;
height:70px;
width:160px;
padding:25px;
color:#eee;
}
.spinner {
position: fixed;
top: 50%;
left: 50%;
margin-left: -50px;
margin-top: -50px;
text-align:center;
z-index:1234;
overflow: auto;
width: 100px;
height: 102px;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
/*!
* jQuery Tools v1.2.7 - The missing UI library for the Web
*
* overlay/overlay.js
* scrollable/scrollable.js
* tabs/tabs.js
* tooltip/tooltip.js
*
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
*
* http://flowplayer.org/tools/
*
*/
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.overlay={addEffect:function(a,b,d){c[a]=[b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var b=[],c={};a.tools.overlay.addEffect("default",function(b,c){var d=this.getConf(),e=a(window);d.fixed||(b.top+=e.scrollTop(),b.left+=e.scrollLeft()),b.position=d.fixed?"fixed":"absolute",this.getOverlay().css(b).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});function d(d,e){var f=this,g=d.add(f),h=a(window),i,j,k,l=a.tools.expose&&(e.mask||e.expose),m=Math.random().toString().slice(10);l&&(typeof l=="string"&&(l={color:l}),l.closeOnClick=l.closeOnEsc=!1);var n=e.target||d.attr("rel");j=n?a(n):null||d;if(!j.length)throw"Could not find Overlay: "+n;d&&d.index(j)==-1&&d.click(function(a){f.load(a);return a.preventDefault()}),a.extend(f,{load:function(d){if(f.isOpened())return f;var i=c[e.effect];if(!i)throw"Overlay: cannot find effect : \""+e.effect+"\"";e.oneInstance&&a.each(b,function(){this.close(d)}),d=d||a.Event(),d.type="onBeforeLoad",g.trigger(d);if(d.isDefaultPrevented())return f;k=!0,l&&a(j).expose(l);var n=e.top,o=e.left,p=j.outerWidth({margin:!0}),q=j.outerHeight({margin:!0});typeof n=="string"&&(n=n=="center"?Math.max((h.height()-q)/2,0):parseInt(n,10)/100*h.height()),o=="center"&&(o=Math.max((h.width()-p)/2,0)),i[0].call(f,{top:n,left:o},function(){k&&(d.type="onLoad",g.trigger(d))}),l&&e.closeOnClick&&a.mask.getMask().one("click",f.close),e.closeOnClick&&a(document).on("click."+m,function(b){a(b.target).parents(j).length||f.close(b)}),e.closeOnEsc&&a(document).on("keydown."+m,function(a){a.keyCode==27&&f.close(a)});return f},close:function(b){if(!f.isOpened())return f;b=b||a.Event(),b.type="onBeforeClose",g.trigger(b);if(!b.isDefaultPrevented()){k=!1,c[e.effect][1].call(f,function(){b.type="onClose",g.trigger(b)}),a(document).off("click."+m+" keydown."+m),l&&a.mask.close();return f}},getOverlay:function(){return j},getTrigger:function(){return d},getClosers:function(){return i},isOpened:function(){return k},getConf:function(){return e}}),a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),i=j.find(e.close||".close"),!i.length&&!e.close&&(i=a("<a class=\"close\"></a>"),j.prepend(i)),i.click(function(a){f.close(a)}),e.load&&f.load()}a.fn.overlay=function(c){var e=this.data("overlay");if(e)return e;a.isFunction(c)&&(c={onBeforeLoad:c}),c=a.extend(!0,{},a.tools.overlay.conf,c),this.each(function(){e=new d(a(this),c),b.push(e),a(this).data("overlay",e)});return c.api?e:this}})(jQuery);
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),e.size>1&&(e.circular=!1),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return n.add(o)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.find(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(e.size,a)},prev:function(a){return f.move(-e.size,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children().last().before(b),h.children().first().replaceWith(b.clone().addClass(e.clonedClass))):(h.append(b),o.removeClass("disabled")),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}});var m=b.parents().add(b).filter(function(){if(a(this).css("display")==="none")return!0});m.length?(m.show(),f.seekTo(0,0,function(){}),m.hide()):f.seekTo(0,0,function(){})}var n=c(b,e.prev).click(function(a){a.stopPropagation(),f.prev()}),o=c(b,e.next).click(function(a){a.stopPropagation(),f.next()});e.circular||(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(n.toggleClass(e.disabledClass,b<=0),o.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||n.addClass(e.disabledClass)),f.getSize()<2&&n.add(o).addClass(e.disabledClass),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var p={};h[0].ontouchstart=function(a){var b=a.touches[0];p.x=b.clientX,p.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=p.x-b.clientX,d=p.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).on("keydown.scrollable",function(b){if(!(!e.keyboard||b.altKey||b.ctrlKey||b.metaKey||a(b.target).is(":input"))){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialEffect:!1,initialIndex:0,event:"click",rotate:!1,slideUpSpeed:400,slideDownSpeed:400,history:!1},addEffect:function(a,c){b[a]=c}};var b={"default":function(a,b){this.getPanes().hide().eq(a).show(),b.call()},fade:function(a,b){var c=this.getConf(),d=c.fadeOutSpeed,e=this.getPanes();d?e.fadeOut(d):e.hide(),e.eq(a).fadeIn(c.fadeInSpeed,b)},slide:function(a,b){var c=this.getConf();this.getPanes().slideUp(c.slideUpSpeed),this.getPanes().eq(a).slideDown(c.slideDownSpeed,b)},ajax:function(a,b){this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"),b)}},c,d;a.tools.tabs.addEffect("horizontal",function(b,e){if(!c){var f=this.getPanes().eq(b),g=this.getCurrentPane();d||(d=this.getPanes().eq(0).width()),c=!0,f.show(),g.animate({width:0},{step:function(a){f.css("width",d-a)},complete:function(){a(this).hide(),e.call(),c=!1}}),g.length||(e.call(),c=!1)}});function e(c,d,e){var f=this,g=c.add(this),h=c.find(e.tabs),i=d.jquery?d:c.children(d),j;h.length||(h=c.children()),i.length||(i=c.parent().find(d)),i.length||(i=a(d)),a.extend(this,{click:function(d,i){var k=h.eq(d),l=!c.data("tabs");typeof d=="string"&&d.replace("#","")&&(k=h.filter("[href*=\""+d.replace("#","")+"\"]"),d=Math.max(h.index(k),0));if(e.rotate){var m=h.length-1;if(d<0)return f.click(m,i);if(d>m)return f.click(0,i)}if(!k.length){if(j>=0)return f;d=e.initialIndex,k=h.eq(d)}if(d===j)return f;i=i||a.Event(),i.type="onBeforeClick",g.trigger(i,[d]);if(!i.isDefaultPrevented()){var n=l?e.initialEffect&&e.effect||"default":e.effect;b[n].call(f,d,function(){j=d,i.type="onClick",g.trigger(i,[d])}),h.removeClass(e.current),k.addClass(e.current);return f}},getConf:function(){return e},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return f.click(j+1)},prev:function(){return f.click(j-1)},destroy:function(){h.off(e.event).removeClass(e.current),i.find("a[href^=\"#\"]").off("click.T");return f}}),a.each("onBeforeClick,onClick".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),e.history&&a.fn.history&&(a.tools.history.init(h),e.event="history"),h.each(function(b){a(this).on(e.event,function(a){f.click(b,a);return a.preventDefault()})}),i.find("a[href^=\"#\"]").on("click.T",function(b){f.click(a(this).attr("href"),b)}),location.hash&&e.tabs=="a"&&c.find("[href=\""+location.hash+"\"]").length?f.click(location.hash):(e.initialIndex===0||e.initialIndex>0)&&f.click(e.initialIndex)}a.fn.tabs=function(b,c){var d=this.data("tabs");d&&(d.destroy(),this.removeData("tabs")),a.isFunction(c)&&(c={onBeforeClick:c}),c=a.extend({},a.tools.tabs.conf,c),this.each(function(){d=new e(a(this),b,c),a(this).data("tabs",d)});return c.api?d:this}})(jQuery);
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

View File

@ -0,0 +1,40 @@
function playSound(value){
var sound;
if(value==1){
sound = new Audio("sounds/aircraftalarm.wav");
}
if(value==2){
sound = new Audio("sounds/air_shock_alarm.wav");
}
if(value==3){
sound = new Audio("sounds/alien_alarm.wav");
}
if(value==4){
sound = new Audio("sounds/alien_beacon.wav");
}
if(value==5){
sound = new Audio("sounds/bell_school_ringing.wav");
}
if(value==6){
sound = new Audio("sounds/Door_Alarm.wav");
}
if(value==7){
sound = new Audio("sounds/EAS_beep.wav");
}
if(value==8){
sound = new Audio("sounds/Firewarner.wav");
}
if(value==9){
sound = new Audio("sounds/HardPCMAlarm.wav");
}
if(value==10){
sound = new Audio("sounds/negativebeep.wav");
}
if(value==11){
sound = new Audio("sounds/Star_Trek_emergency_simulation.wav");
}
if(value==0){
sound = new Audio("sounds/aircraftalarm.wav");
}
sound.play();
}

View File

@ -0,0 +1,27 @@
{
"name": "__MSG_name__",
"version": "1.1",
"description": "__MSG_description__",
"browser_action": {
"default_title": "__MSG_default_title__",
"default_icon": "images/icon.png",
"default_popup": "popup.html"
},
"background": {
"page": "background.html"
},
"icons": {
"128": "images/icon128.png",
"16": "images/icon16.png",
"32": "images/icon32.png",
"48": "images/icon48.png"
},
"options_page": "options.html",
"permissions": [
"tabs",
"notifications",
"http://*/*",
"background"
],
"default_locale": "en"
}

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Wicket Alert</title>
<style type="text/css">
body { margin:0; font-family:arial; font-size:10pt }
h1 { font-weight:bold; font-size:16px; margin:2px 0 2px 4px; color:#0068C4; font-family:arial; }
a { color: #035BAC; text-decoration:none; }
a:hover { text-decoration:underline; }
a:visited { color: #035BAC; text-decoration:none; }
a:visited:hover { text-decoration:underline; }
</style>
</head>
<body>
<h1>Event Alert</h1>
<div id="e" style="background:url('images/icon.png') no-repeat 0% 50%; margin:0 4px; padding-left:50px; min-height:48px;">
<script type="text/javascript">
var url = window.location.href;
var re = /\?event=(\d+)/;
if(re.exec(url)) {
if(!isNaN(RegExp.$1)) {
var eventId = RegExp.$1;
document.write(chrome.extension.getBackgroundPage().getNotification(eventId));
}
}
window.onload = function () {
setTimeout(function() {
window.close();
}, 10000);
}
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,277 @@
<!doctype html>
<html>
<head>
<title>Pandora FMS extension</title>
<link rel="stylesheet" href="css/popup.css" type="text/css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/sound.js"></script>
<script type="text/javascript">
$(document).ready(function(){
document.getElementById('ip_address').value = localStorage["ip_address"];
document.getElementById('api_pass').value = localStorage["api_pass"];
document.getElementById('user_name').value = localStorage["user_name"];
document.getElementById('pass').value = localStorage["pass"];
document.getElementById('critical').value = localStorage["critical"];
document.getElementById('informational').value = localStorage["informational"];
document.getElementById('maintenance').value = localStorage["maintenance"];
document.getElementById('normal').value = localStorage["normal"];
document.getElementById('warning').value = localStorage["warning"];
document.getElementById('refresh').value = localStorage["refresh"];
document.getElementById('events').value = localStorage["events"];
if(localStorage["sound_alert"]=="on"){
disable(false);
document.getElementById('sound_alert_o').checked=true;
}
if(localStorage["sound_alert"]=="off"){
disable(true);
document.getElementById('sound_alert_f').checked=true;
}
$("#demo [title]").tooltip();
});
function change(value, id){
playSound(value);
if(id=="critical"){
localStorage["critical"]=value;
}
if(id=="informational"){
localStorage["informational"]=value;
}
if(id=="maintenance"){
localStorage["maintenance"]=value;
}
if(id=="normal"){
localStorage["normal"]=value;
}
if(id=="warning"){
localStorage["warning"]=value;
}
}
function change_o(value, id){
if(id=="refresh"){
localStorage["refresh"]=value;
}
if(id=="events"){
localStorage["events"]=value;
}
}
function change_global(value,id){
bg=chrome.extension.getBackgroundPage();
bg.location.reload();
if(id=="ip_address"){
localStorage["ip_address"]=value;
}
if(id=="api_pass"){
localStorage["api_pass"]=value;
}
if(id=="user_name"){
localStorage["user_name"]=value;
}
if(id=="pass"){
localStorage["pass"]=value;
}
if(id=="sound_alert"){
localStorage["sound_alert"]=value;
if(localStorage["sound_alert"]=="off"){
disable(true);
}
if(localStorage["sound_alert"]=="on"){
disable(false);
}
}
}
function disable(state){
if(state){
document.getElementById("critical").disabled=true;
document.getElementById("informational").disabled=true;
document.getElementById("maintenance").disabled=true;
document.getElementById("normal").disabled=true;
document.getElementById("warning").disabled=true;
}
if(!state){
document.getElementById("critical").disabled=false;
document.getElementById("informational").disabled=false;
document.getElementById("maintenance").disabled=false;
document.getElementById("normal").disabled=false;
document.getElementById("warning").disabled=false;
}
}
</script>
<div id="demo">
<div class="options_header">
<img src="images/pandora.jpg">
</div>
<div class="options_divider"><h2>Options Menu</h2></div>
<div class="options_textarea">
<table width=450px>
<caption><h3>Global Parameters</h3></caption>
<tr>
<td title="IP address of server eg: http://127.0.0.1/pandora_console" style="cursor:help">IP Address</td>
<td><input type="text" size=50px name="ip_address" id="ip_address" onChange="change_global(this.value, 'ip_address');"> </td>
</tr>
<tr>
<td title="API password of the server" style="cursor:help">API Password</td>
<td><input type="password" size=50px name="api_pass" id="api_pass" onChange="change_global(this.value, 'api_pass');" ></td>
</tr>
<tr>
<td title="A valid user name" style="cursor:help">User name</td>
<td> <input type="text" size=50px name="user_name" id="user_name" onChange="change_global(this.value, 'user_name');"> </td>
</tr>
<tr>
<td title="Password" style="cursor:help">Password</td>
<td> <input type="password" size=50px name="pass" id="pass" onChange="change_global(this.value, 'pass');"> </td>
</tr>
</table>
<table width=450px>
<caption><h3>Event Alert Sounds Configuration</h3></caption>
<tr>
<td title="All sound alerts of notifications on/off" style="cursor:help">Sound Alerts </td>
<td>
<input type="radio" id="sound_alert_o" name="sound_alert" value="on" onChange="change_global(this.value, 'sound_alert');"/> On
<input type="radio" id="sound_alert_f" name="sound_alert" value="off" onChange="change_global(this.value, 'sound_alert');"/> Off
</td>
</tr>
<tr>
<td><b>Severity</b></td>
<td ><b>Sound Type</b></td>
</tr>
<tr>
<td>Critical</td>
<td>
<select id="critical" onChange="change(this.options[selectedIndex].value, 'critical');">
<option value="1">Air Craft Alarm</option>
<option value="2">Air Shock Alarm</option>
<option value="3">Alien Alarm</option>
<option value="4">Alien Beacon</option>
<option value="5">Bell Ringing</option>
<option value="6">Door Alarm</option>
<option value="7">EAS Beep</option>
<option value="8">Fire Warner</option>
<option value="9">Hard PCM Alarm</option>
<option value="10">Negative Beep</option>
<option value="11">Star Trek Emergency Alarm</option>
</select>
</td>
</tr>
<tr>
<td>Informational</td>
<td>
<select id="informational" onChange="change(this.options[selectedIndex].value, 'informational');">
<option value="1">Air Craft Alarm</option>
<option value="2">Air Shock Alarm</option>
<option value="3">Alien Alarm</option>
<option value="4">Alien Beacon</option>
<option value="5">Bell Ringing</option>
<option value="6">Door Alarm</option>
<option value="7">EAS Beep</option>
<option value="8">Fire Warner</option>
<option value="9">Hard PCM Alarm</option>
<option value="10">Negative Beep</option>
<option value="11">Star Trek Emergency Alarm</option>
</select>
</td>
</tr>
<tr>
<td>Maintenance</td>
<td>
<select id="maintenance" onChange="change(this.options[selectedIndex].value, 'maintenance');">
<option value="1">Air Craft Alarm</option>
<option value="2">Air Shock Alarm</option>
<option value="3">Alien Alarm</option>
<option value="4">Alien Beacon</option>
<option value="5">Bell Ringing</option>
<option value="6">Door Alarm</option>
<option value="7">EAS Beep</option>
<option value="8">Fire Warner</option>
<option value="9">Hard PCM Alarm</option>
<option value="10">Negative Beep</option>
<option value="11">Star Trek Emergency Alarm</option>
</select>
</td>
</tr>
<tr>
<td>Normal</td>
<td>
<select id="normal" onChange="change(this.options[selectedIndex].value, 'normal');">
<option value="1">Air Craft Alarm</option>
<option value="2">Air Shock Alarm</option>
<option value="3">Alien Alarm</option>
<option value="4">Alien Beacon</option>
<option value="5">Bell Ringing</option>
<option value="6">Door Alarm</option>
<option value="7">EAS Beep</option>
<option value="8">Fire Warner</option>
<option value="9">Hard PCM Alarm</option>
<option value="10">Negative Beep</option>
<option value="11">Star Trek Emergency Alarm</option>
</select>
</td>
</tr>
<tr>
<td>Warning</td>
<td>
<select id="warning" onChange="change(this.options[selectedIndex].value,'warning');">
<option value="1">Air Craft Alarm</option>
<option value="2">Air Shock Alarm</option>
<option value="3">Alien Alarm</option>
<option value="4">Alien Beacon</option>
<option value="5">Bell Ringing</option>
<option value="6">Door Alarm</option>
<option value="7">EAS Beep</option>
<option value="8">Fire Warner</option>
<option value="9">Hard PCM Alarm</option>
<option value="10">Negative Beep</option>
<option value="11">Star Trek Emergency Alarm</option>
</select>
</td>
</tr>
<tr>
<td title="Automatic Refresh time to fetch new events" style="cursor:help">Auto Refresh Time</td>
<td>
<select id="refresh" onChange="change_o(this.options[selectedIndex].value,'refresh');">
<option value="5">5 seconds</option>
<option value="10">10 seconds</option>
<option value="15">15 seconds</option>
<option value="30">30 seconds</option>
<option value="60">1 minute</option>
<option value="120">2 minutes</option>
<option value="300">5 minutes</option>
<option value="900">15 minutes</option>
<option value="1800">30 minutes</option>
<option value="3600">1 hour</option>
</select>
</td>
</tr>
<tr>
<td title="Number of events to be displayed in pop up window" style="cursor:help">Number of events</td>
<td>
<select id="events" onChange="change_o(this.options[selectedIndex].value,'events');">
<option value="5">5</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="14">14</option>
<option value="16">16</option>
<option value="18">18</option>
<option value="20">20</option>
</select>
</td>
</tr>
</table>
<button type="button" onclick="window.close()"><h3>Close</h3></button>
</div>
<script src="js/popup.js"></script>
</head>
<body>

View File

@ -0,0 +1,223 @@
<html>
<head>
<link rel="stylesheet" href="css/popup.css" type="text/css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script>
var timer = null;
var event_array;
var max_events;
var bg;
$(document).ready(function(){
max_events=localStorage["events"];
if(localStorage["events"]==undefined){
localStorage["events"]="20";
}
bg=chrome.extension.getBackgroundPage();
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(mainPoP , 2000 );
});
function mainPoP(){
if(bg.check()){
showEvents();
}
else
{
showUrlError();
}
}
function showUrlError(){
var res=document.createDocumentFragment();
var r = document.getElementById('e');
var eve=document.createElement('div');
eve.id="event_temp";
eve.setAttribute("class","b");
var p = document.createElement('a');
p.href="options.html";
p.target="_blank";
p.innerText="Configure ip address,API password, user name and password with correct values";
eve.appendChild(p);
res.appendChild(eve);
r.parentNode.insertBefore(res,r);
$('.loader').hide();
$('div.b').show();
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(refresh , 1000 );
}
function showDataError(){
var res=document.createDocumentFragment();
var r = document.getElementById('e');
var eve=document.createElement('div');
eve.id="event_temp";
eve.setAttribute("class","b");
var p = document.createElement('a');
p.innerText="Error in fetching data!! Check your internet connection";
eve.appendChild(p);
res.appendChild(eve);
r.parentNode.insertBefore(res,r);
$('.loader').hide();
$('div.b').show();
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(refresh , 1000 );
}
function showEvents(){
var allEvents=bg.fetchEvents();
var r = document.getElementById('e');
var res=document.createDocumentFragment();
var eve=document.createElement('div');
eve.id="event_temp";
eve.setAttribute("class","b");
var i=0;
if(allEvents.length>0){
while(i<max_events){
var eve_title=document.createElement('div');
var img = document.createElement('img');
img.src = 'images/plus.gif';
img.width = '9';
img.height='9';
img.className ='pm';
img.id='i_' + i;
eve_title.appendChild(img);
var a = document.createElement('a');
var temp_style;
a.innerText = allEvents[i][6];
if(i<localStorage["new_events"]){
var temp_style="font-weight:bold;";
}
else{
var temp_style="font-weight:normal;";
}
if(allEvents[i][19]=="Warning"){
eve_title.setAttribute("style","background:#FDE84F; margin-bottom:-12px;"+temp_style);
}
if(allEvents[i][19]=="Critical"){
eve_title.setAttribute("style","background:#C60700; margin-bottom:-12px;"+temp_style);
}
if(allEvents[i][19]=="Informational"){
eve_title.setAttribute("style","background:#739FD0; margin-bottom:-12px;"+temp_style);
}
if(allEvents[i][19]=="Normal"){
eve_title.setAttribute("style","background:#8AE234; margin-bottom:-12px;"+temp_style);
}
if(allEvents[i][19]=="Maintenance"){
eve_title.setAttribute("style","background:#BABDB6; margin-bottom:-12px;"+temp_style);
}
eve_title.appendChild(a);
eve.appendChild(eve_title);
var b = document.createElement('br');
eve.appendChild(b);
var time=allEvents[i][5].split(" ");
var time_text = time[0]+" "+time[1];
var p = document.createElement('p');
var id;
if(allEvents[i][9]==0){
id=".";
}
else {
id= " in the module with Id "+ allEvents[i][9] + ".";
}
p.innerText = allEvents[i][14]+" : "+allEvents[i][17]+". Event occured at "+ time_text+id;
p.id = 'p_' + i;
eve.appendChild(p);
i++;
}
res.appendChild(eve);
r.parentNode.insertBefore(res,r);
$('img.pm').click(showHide);
$('.loader').hide();
$('div.b').show();
}
else{
showDataError();
}
localStorage["new_events"]=0;
bg.hideBadge();
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(refresh , 30*1000 );
}
function showHide() {
var id = $(this).attr('id');
var num = id.split("_")[1];
var pid = "p_" + num;
if($('#' + pid).css('display') == 'none') {
$('#' + pid).slideDown("fast");
$(this).attr({src: 'images/minus.gif'});
}
else {
$('#' + pid).slideUp("fast");
$(this).attr({src: 'images/plus.gif'});
}
}
function refresh(){
localStorage["new_events"]=0;
bg.hideBadge();
var e = document.getElementById('event_temp');
if(e){
e.parentNode.removeChild(e);
}
mainPoP();
}
function mrefresh(){
localStorage["new_events"]=0;
bg.hideBadge();
var bg=chrome.extension.getBackgroundPage();
bg.location.reload();
var e = document.getElementById('event_temp');
if(e){
e.parentNode.removeChild(e);
}
mainPoP();
}
</script>
</head>
<body>
<div>
<div id="head">
<a href=""><img src="images/logo.png" border="0"/></a><a href="options.html" target="_blank"><img src="images/gear.png" style='float:right;padding:5px 5px 0 0;border:0px' title="Options"></a>
<a onclick="mrefresh();" style="cursor:pointer" id="m_refresh"><img src="images/refresh.png" style='float:right;padding:5px 5px 0 0;border:0px' title="Refresh"></a>
</div>
<div class="loader"> <img src='images/spinny.gif'/> Loading... </div>
<div class="result" id="result" >
<div class="b" id="event">
<h1>Events</h1>
<div class="e" id="e">
</div>
</div>
</div>
</body>
</html>