//Kirchensoft Java Script Functions
//Date created: 25-OCT-2008
//Scripter: Kirchensoft Winzeler Franz Winzeler
//Kirchensoft Frontend Scripts
function MenuPictureSelected(ele)
{
ele.setStyle({ opacity: 0.5 })
}
function setOpacity( elem, level )
{ // If filters exist, then this is IE, so set the Alpha filter
if ( elem.filters )
{
elem.filters.alpha.opacity = level;
}
// Otherwise use the W3C opacity property
else
{
elem.style.opacity = level / 100;
}
}
function SetMLMenusLinkColorsOver(strLinkEleId, strFontColorOver, strBGColorOver, strBorderColorOver)
{
strLinkEle=document.getElementById(strLinkEleId)
strLinkEle.style.color=strFontColorOver
strLinkEle.style.backgroundColor=strBGColorOver
strLinkEle.style.borderColor=strBorderColorOver
strLinkEle.style.borderWidth="2px"
strLinkEle.style.borderStyle="solid"
}
function SetMLMenusLinkColorsOut(strLinkEleId, strFontColorOut, strBGColorOut, strBorderColorOut)
{
strLinkEle=document.getElementById(strLinkEleId)
strLinkEle.style.color=strFontColorOut
strLinkEle.style.backgroundColor=strBGColorOut
strLinkEle.style.borderColor=strBorderColorOut
strLinkEle.style.borderWidth="2px"
strLinkEle.style.borderStyle="solid"
}
function MarkRowSelected(id,bSwitchInd)
{
tr=document.getElementById(id)
nLoopCount=0
while (nLoopCount
=0)
{
textdescriptionstart=textdescription.replace("ZUM VERGROESSERN EINMAL KLICKEN","ZUM SCHLIESSEN EINMAL KLICKEN")
textdescriptionfull=textdescriptionstart
}
else if (textdescription.indexOf("ZUM VERGROESSERN EINMAL KLICKEN")>=0)
{
textdescriptionstart=textdescription.replace("ZUM VERGROESSERN EINMAL KLICKEN","ZUM SCHLIESSEN EINMAL KLICKEN")
textdescriptionfull=textdescriptionstart
}
else
{
textdescriptionstart=textdescription.replace("ZUM VERGROESSERN EINS ODER ZWEI MAL KLICKEN","ZUM VERGROESSERN EINMAL KLICKEN")
textdescriptionfull=textdescriptionstart.replace("ZUM VERGROESSERN EINMAL KLICKEN","ZUM SCHLIESSEN EINMAL KLICKEN")
}
//new oversteering commands to let appear image only once in full size Kirchensoft 08MAR2015
textdescriptionstart=textdescription.replace("ZUM VERGROESSERN EINS ODER ZWEI MAL KLICKEN","ZUM SCHLIESSEN EINMAL KLICKEN")
textdescriptionstart=textdescriptionstart.replace("ZUM VERGROESSERN EINMAL KLICKEN","ZUM SCHLIESSEN EINMAL KLICKEN")
textdescriptionstart=textdescriptionstart.replace("MIT MAUSKLICK VERGROESSERN","ZUM SCHLIESSEN EINMAL KLICKEN")
textdescriptionstart=textdescriptionstart.replace("MOUSECLICK TO ENLARGE","CLICK ONCE TO CLOSE")
textdescriptionfull=textdescriptionstart
//end new oversteering commands to let appear image only once in full size Kirchensoft 08MAR2015
if (linkid.indexOf("a_t")>=0)
{
imgid=linkid.replace("a_t","img")
}
else if (linkid.indexOf("a_n")>=0)
{
imgid=linkid.replace("a_n","img")
}
else if (linkid.indexOf("a_p")>=0)
{
imgid=linkid.replace("a_p","img")
}
else
{
imgid=linkid.replace("a_st","img")
}
img=document.getElementById(imgid)
imgpath=img.src
if (linkid.indexOf("a_t")>=0)
{
imgpath=imgpath.replace("/thumb","")
imgpath=imgpath.replace("thumb_","normal_")
imgpathnormal=imgpath
imgpathnormal="'"+imgpathnormal+"'"
imgpathorig=img.src
imgpathorig=imgpathorig.replace("/thumb","/orig")
imgpathorig=imgpathorig.replace("thumb_","")
imgpathorig="'"+imgpathorig+"'"
}
else if (linkid.indexOf("a_n")>=0)
{
imgpath=imgpath.replace("normal_","orig/")
imgpathnormal=imgpath
imgpathnormal="'"+imgpathnormal+"'"
imgpathorig=img.src
imgpathorig="'"+imgpathorig+"'"
}
else if (linkid.indexOf("a_p")>=0)
{
imgpathnormal=imgpath
imgpathnormal="'"+imgpathnormal+"'"
imgpathorig=img.src
imgpathorig=imgpathorig.replace("normal_","orig/")
imgpathorig=imgpathorig.replace("normal_","")
imgpathorig="'"+imgpathorig+"'"
}
else
{
imgpath=imgpath.replace("/smallthumb","")
imgpath=imgpath.replace("smallthumb_","normal_")
imgpathnormal=imgpath
imgpathnormal="'"+imgpathnormal+"'"
imgpathorig=img.src
imgpathorig=imgpathorig.replace("/smallthumb","/orig")
imgpathorig=imgpathorig.replace("smallthumb_","")
imgpathorig="'"+imgpathorig+"'"
}
//new oversteering commands to let appear image only once in full size Kirchensoft 08MAR2015
imgpathnormal=imgpathorig
imgpath=imgpathnormal.replace(/'/g,"")
//end new oversteering commands to let appear image only once in full size Kirchensoft 08MAR2015
popwidth=100
popheight=100
//define height and width for max window size
//availWidth=(screen.availWidth-40)
//availHeight=(screen.availHeight-100)
//80% of possible width and height of screen for image
availWidth=(screen.availWidth/100*80)
availHeight=(screen.availHeight/100*80)
resizeFactor=0
imgwidth=Number(imgwidth)
imgheight=Number(imgheight)
if (imgwidth==null)
{
resizeWidth=availWidth
resizeHeight=availHeight
}
else
{
if (imgwidth>availWidth || imgheight>availHeight)
{
if (imgwidth>availWidth)
{
resizeFactor=availWidth/imgwidth
resizeWidth=imgwidth*resizeFactor
resizeHeight=imgheight*resizeFactor
if (resizeHeight>availHeight)
{
resizeFactor=availHeight/resizeHeight
resizeWidth=resizeWidth*resizeFactor
resizeHeight=resizeHeight*resizeFactor
}
}
else
{
resizeFactor=availHeight/imgheight
resizeWidth=imgwidth*resizeFactor
resizeHeight=imgheight*resizeFactor
if (resizeWidth>availWidth)
{
resizeFactor=availWidth/resizeWidth
resizeWidth=resizeWidth*resizeFactor
resizeHeight=resizeHeight*resizeFactor
}
}
}
else
{
resizeWidth=imgwidth
resizeHeight=imgheight
}
}
//popwidth=resizeWidth/100*102
//popheight=resizeHeight/100*105
popwidth=resizeWidth/100*104
popheight=resizeHeight/100*113
//if (imgwidth==null)
//{
// resizeWidth=availWidth
// resizeHeight=availHeight
//}
//else
//{
//if (imgwidth>imgheight)
//{
//landscape
//if (imgwidth>availWidth)
//{
//resize available width and height
//resizeFactor=availWidth/imgwidth
//resizeWidth=imgwidth*resizeFactor
//resizeHeight=imgheight*resizeFactor
//if (resizeHeight>availHeight)
//{
//resizeFactor=availHeight/resizeHeight
//resizeWidth=resizeWidth*resizeFactor
//resizeHeight=resizeHeight*resizeFactor
//}
//}
//else
//{
//resizeWidth=(imgwidth+40)
//resizeHeight=(imgheight+40)
//}
//}
//else
//{
//portrait
//if (imgheight>availHeight)
//{
//resize available width and height
//resizeFactor=availHeight/imgheight
//resizeWidth=imgwidth*resizeFactor
//resizeHeight=imgheight*resizeFactor
//if (resizeWidth>availWidth)
//{
//resizeFactor=availWidth/resizeWidth
//resizeWidth=resizeWidth*resizeFactor
//resizeHeight=resizeHeight*resizeFactor
//}
//}
//else
//{
//resizeWidth=(imgwidth+40)
//resizeHeight=(imgheight+40)
//}
//}
//}
function getpos(){
//leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
//toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (linkid.indexOf("a_n")>=0)
{
leftpos=10
toppos=10
}
else if (textdescription.indexOf("ZUM VERGROESSERN EINMAL KLICKEN")>=0)
{
leftpos=10
toppos=10
}
else
{
//leftpos=250
//toppos=120
leftpos=10
toppos=10
}
//leftpos=(screen.availWidth-popwidth)/2
//toppos=(screen.availHeight-popheight)/2
leftpos=0
toppos=0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}
function ResizeScreen()
{
jkpopwin.resizeTo(popwidth, popheight)
}
getpos()
startWidth=200
startHeight=200
//var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos+',titlebar=no, scrollbars=yes'
//var winattributes='screen.height='+popheight+',screen.width='+popwidth+',resizable=yes,left='+leftpos+',top='+toppos+',titlebar=no, scrollbars=no, menubar=no, status=no, directories=no, location=no, channelmode=yes'
//var winattributes='screen.availHeight='+popheight+',screen.availWidth='+popwidth+',resizable=yes,left='+leftpos+',top='+toppos+',titlebar=no, scrollbars=no, menubar=no, status=no, directories=no, location=no, channelmode=yes'
//var winattributes='window.innerHeight ='+popheight+',window.innerWidth ='+popwidth+',resizable=yes,left='+leftpos+',top='+toppos+',titlebar=no, scrollbars=no, menubar=no, status=no, directories=no, location=no, channelmode=yes'
var winattributes='width ='+startHeight+',height ='+startWidth+',resizable=yes,left='+leftpos+',top='+toppos+',titlebar=no, scrollbars=yes, menubar=no, status=no, directories=no, location=no, channelmode=no'
//alert(popwidth)
//alert(popheight)
var windowname="Kirchensoft Foto"
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//jkpopwin.moveTo(leftpos, toppos)
//jkpopwin.resizeTo(popwidth, popheight)
}
//setTimeout(ResizeScreen(),10)
//jkpopwin.resizeTo(popwidth, popheight)
jkpopwin.document.open()
//docstring=''+windowtitle+'';
//docstring=''+windowtitle+'';
//docstring=''+windowtitle+'';
docstring=''+windowtitle+'';
jkpopwin.document.write(docstring)
img=jkpopwin.document.getElementById(imgid)
t=setTimeout("ClearTimeout(t,jkpopwin)",10)
}
//Kirchensoft Java Script Functions
//Date created: 25-OCT-2008
//Scripter: Kirchensoft Winzeler Franz Winzeler
//Kirchensoft Scripts
function KSKeyPress(e)
{
var characterCode = 0;
var bLeftInd=true;
e=e || window.event
if (e && e.which) {
characterCode = e.which;
} else {
characterCode = e.keyCode;
}
if (characterCode == 13) {
searcharg=document.getElementById("strFullSearchLeft").value
if (searcharg==null)
{
bLeftInd=false
searcharg=document.getElementById("strFullSearchRight").value
}
if (searcharg!=null)
{
if (searcharg=="")
{
if (confirm("Sie haben kein Suchkriterium eingegeben, wollen Sie trotzdem weiter suchen, dann bestätigen Sie mit OK")==true)
{
formInitSearch("FullSearchOption",bLeftInd);
}
}
else
{
formInitSearch("FullSearchOption",bLeftInd);
}
}
}
}
function formShowMsgSimple(strStatusLineText)
{
sfHoverCalcRestTop()
var bShowStatusText=true
strURLMsg=ValidateURLArgsPerName('urlMsg')
eleBtn = document.getElementById("MsgLine")
if (strURLMsg!="")
{
strURLMsg = strURLMsg.replace(/%20/g,' ')
alert(strURLMsg)
}
else
{
if (eleBtn.value != "")
{
alert(eleBtn.value)
}
}
if (strStatusLineText===undefined)
{
bShowStatusText=false
}
if (bShowStatusText==true)
{
startBanner(strStatusLineText)
}
shortcut.add("Ctrl+I",function() {
CallLoginPage();
},
{
'type':'keydown',
'propagate':false,
'disable_in_input':false,
'target':document
});
shortcut.add("Ctrl+Z",function() {
CallBackToBackend();
},
{
'type':'keydown',
'propagate':false,
'disable_in_input':false,
'target':document
});
shortcut.add("Ctrl+W",function() {
DirectCallWebCalendar();
},
{
'type':'keydown',
'propagate':false,
'disable_in_input':false,
'target':document
});
shortcut.add("Ctrl+N",function() {
DirectCallTerminWebCalendar();
},
{
'type':'keydown',
'propagate':false,
'disable_in_input':false,
'target':document
});
}
function getStyle(element,property)
{
// Beim IE kann man (ueber currentStyle - IE5+) keine Eigenschaften
// abfragen, die kombinierte Werte enthalten (border, borderBottom, ...)
// Andererseits gibt es zu clip hier auch clipTop, clipRight, clipBottom & ClipLeft.
var result="";
obj=getObject(element);
if(obj) {
if(window.getComputedStyle) {
result=window.getComputedStyle(obj,"").getPropertyValue(property);
} else if(obj.currentStyle) {
result=obj.currentStyle[propertyToStyle(property)];
} else if(obj.style) {
result=obj.style[propertyToStyle(property)];
}
}
return result;
}
function propertyToStyle(property) {
// 1. Eigenschaften mit reserviertem Bezeichner: Unterscheidung nach JScript- bzw. JavaScript-Syntax
if(property=="float") { property=((typeof(window.cssFloat)=="undefined")?"style":"css")+property.charAt(0).toUpperCase()+property.substring(1); }
// 2. Eigenschaften mit Bindestrich
else if(property.indexOf("-")>=0) {
// CSS-Syntax am "-" auftrennen, ...
syntax=property.split("-");
// ... ersten Teil uebernehmen und ...
property=syntax[0];
// ... folgende Teile mit grossem Anfangsbuchstaben
for(i=1; i1)?lastParam.toLowerCase().replace(",","\/"):"object/id/name/tagname";
// Wenn element bereits Objekt ist und auch dieser Typ sein darf
if(typeof(element)=="object" && type.indexOf("object")>=0) { obj=element; }
else if(document.getElementById) {
number=(typeof(number)=="number")?number:0;
types=type.split("/");
for(i in types) {
if(types[i]=="id" && document.getElementById(element)) { obj=document.getElementById(element); break; }
else if(types[i]=="name" && document.getElementsByName(element) && document.getElementsByName(element)[number]) { obj=document.getElementsByName(element)[number]; break; }
else if(types[i]=="tagname" && document.getElementsByTagName(element) && document.getElementsByTagName(element)[number]) { obj=document.getElementsByTagName(element)[number]; break; }
}
}
}
return obj;
}
$(document).ready(function()
{
sfHover();
});
$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover(
function() { $(this).addClass(c); },
function() { $(this).removeClass(c); }
);
});
};
function sfHover()
{
$("#sf_nav_top > li > ul").fadeOut("fast");
$("#sf_nav_top li").hover(
function(){ $(this).find("ul:first").fadeIn(1000); },
function(){ $(this).find("ul:first").fadeOut("fast"); }
);
if (document.all) {
$("#sf_nav_top li").hoverClass ("sfHover");
}
$(".sf_ML_Pseudo_Left > li > ul").fadeOut("fast");
$(".sf_ML_Pseudo_Left li").hover(
function(){ $(this).find("ul:first").fadeIn(1000); },
function(){ $(this).find("ul:first").fadeOut("fast"); }
);
if (document.all) {
$(".sf_ML_Pseudo_Left li").hoverClass ("sfHover");
}
$(".sf_ML_Pseudo_Right > li > ul").fadeOut("fast");
$(".sf_ML_Pseudo_Right li").hover(
function(){ $(this).find("ul:first").fadeIn(1000); },
function(){ $(this).find("ul:first").fadeOut("fast"); }
);
if (document.all) {
$(".sf_ML_Pseudo_Right li").hoverClass ("sfHover");
}
sfHoverCalcRestTop();
sfAdaptMenuPositions();
}
function sfAdaptMenuPositions()
{
var myHeight = 0;
var middlePos=0;
if( document.documentElement && ( document.documentElement.clientHeight) )
{
//IE 6+ in 'standards compliant mode'
myHeight = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientHeight) )
{
//IE 4 compatible
myHeight = document.body.clientHeight;
}
middlePos=Math.round(myHeight/2);
var ULs = document.getElementsByTagName("UL");
for (var i=0; i-29)
{
//if value greater than -29, it would move down
//what is not possible, therefore keep Standard Abweichung
ULFirstCorrection=-29;
}
else
{
//move up required, further calculations
if (Math.abs(ULFirstCorrection)<=29)
{
ULFirstCorrection=-29;
}
else
{
ULFirstMaxCorr=ULFirstHeight-9;
if (Math.abs(ULFirstCorrection)>ULFirstMaxCorr)
{
ULFirstCorrection=-ULFirstMaxCorr;
}
}
}
ULFirstCorrectionPx=ULFirstCorrection + "px";
var LIsFirstLevel = ULsFirstLevel[k].getElementsByTagName("LI");
for (var l=0; l-29)
{
//if value greater than -29, it would move down
//what is not possible, therefore keep Standard Abweichung
ULSecondCorrection=-29;
}
else
{
//move up required, further calculations
if (Math.abs(ULSecondCorrection)<=29)
{
ULSecondCorrection=-29;
}
else
{
ULSecondMaxCorr=ULSecondHeight-9;
if (Math.abs(ULSecondCorrection)>ULSecondMaxCorr)
{
ULSecondCorrection=-ULSecondMaxCorr;
}
}
}
ULSecondCorrectionPx=ULSecondCorrection + "px";
ULsSecondLevel[m].style.marginTop=ULSecondCorrectionPx;
}
}
}
}
ULsFirstLevel[k].style.marginTop=ULFirstCorrectionPx;
}
}
}
}
}
}
}
function sfHoverCalcRestTop()
{
menuTop=document.getElementById("sf_nav_top")
usedWidth=Number()
if (menuTop!=null)
{
var sfEls = document.getElementById("sf_nav_top").getElementsByTagName("LI");
for (var i=0; i= 0)
{
cls = cls.replace(oldval,newval)
}
else
{
if (cls.indexOf(newval)< 0)
{
cls = cls + newval
}
}
return cls
}
// Statusbar Scripts
// Copyright (c) 1996 Tomer Shiran. All rights reserved.
// Permission given to use this script provided that the copyright
// notice remains as is. Additional scripts and information are
// available at http://www.geocities.com/SiliconValley/9000/
// set speed of banner (pause in milliseconds between characters)
var speed = 50 // decrease value to increase speed (must be positive)
// set pause between completion of message and beginning of following message
var pause = 1500 // increase value to increase pause
// set initial values
var timerID = null
var bannerRunning = false
// create global array
var ar = new Array()
// assign the strings to the array's elements
ar[0] = "Wenn Sie wollen, schalten Sie jetzt die Lautsprecher ein"
ar[1] = "Sie hören jetzt gerade "
// set index of first message to be displayed first
var currentMessage = 0
// set index of last character to be displayed first
var offset = 0
// stop the banner if it is currently running
function stopBanner() {
// if banner is currently running
if (bannerRunning)
// stop the banner
clearTimeout(timerID)
// timer is now stopped
bannerRunning = false
}
// start the banner
function startBanner(strStatusLineText) {
// make sure the banner is stopped
stopBanner()
ar[1]=ar[1]+strStatusLineText
// start the banner from the current position
showBanner()
}
// type-in the current message
function showBanner() {
// assign current message to variable
var text = ar[currentMessage]
// if current message has not finished being displayed
if (offset < text.length) {
// if last character of current message is a space
if (text.charAt(offset) == " ")
// skip the current character
offset++
// assign the up-to-date to-be-displayed substring
// second argument of method accepts index of last character plus one
var partialMessage = text.substring(0, offset + 1)
// display partial message in status bar
window.status = partialMessage
// increment index of last character to be displayed
offset++ // IE sometimes has trouble with "++offset"
// recursive call after specified time
timerID = setTimeout("showBanner()", speed)
// banner is running
bannerRunning = true
} else {
// reset offset
offset = 0
// increment subscript (index) of current message
currentMessage++
// if subscript of current message is out of range
if (currentMessage == ar.length)
// wrap around (start from beginning)
currentMessage = 0
// recursive call after specified time
timerID = setTimeout("showBanner()", pause)
// banner is running
bannerRunning = true
}
}
function KS_SetVisibilityMLMenus(VisibleInd)
{
if (VisibleInd==true)
{
Visibility="visible"
}
else
{
Visibility="hidden"
}
var ElementsToToggle = [];
ElementsToToggle=document.getElementsByTagName("div");
for(var j=0; j=0)
{
tempID=theElement.id.replace("HM_KS_","")
foundPos=tempID.search("_")
if (foundPos!=-1)
{
tempID=tempID.substr(foundPos+1)
foundPos=tempID.search("_")
if (foundPos==-1)
{
theElement.style.visibility=Visibility;
}
else
{
tempID=tempID.substr(foundPos+1)
if (tempID.charAt(0)=="I")
{
theElement.style.visibility=Visibility;
}
}
}
}
}
return true;
}
// Key Handle functions
/**
* http://www.openjs.com/scripts/events/keyboard_shortcuts/
* Version : 2.01.B
* By Binny V A
* License : BSD
*/
shortcut = {
'all_shortcuts':{},//All the shortcuts are stored in this array
'add': function(shortcut_combination,callback,opt) {
//Provide a set of default options
var default_options = {
'type':'keydown',
'propagate':false,
'disable_in_input':false,
'target':document,
'keycode':false
}
if(!opt) opt = default_options;
else {
for(var dfo in default_options) {
if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
}
}
var ele = opt.target;
if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
var ths = this;
shortcut_combination = shortcut_combination.toLowerCase();
//The function to be called at keypress
var func = function(e) {
e = e || window.event;
if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
var element;
if(e.target) element=e.target;
else if(e.srcElement) element=e.srcElement;
if(element.nodeType==3) element=element.parentNode;
if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return;
}
//Find Which key is pressed
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code).toLowerCase();
if(code == 188) character=","; //If the user presses , when the type is onkeydown
if(code == 190) character="."; //If the user presses , when the type is onkeydown
var keys = shortcut_combination.split("+");
//Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
var kp = 0;
//Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
var shift_nums = {
"`":"~",
"1":"!",
"2":"@",
"3":"#",
"4":"$",
"5":"%",
"6":"^",
"7":"&",
"8":"*",
"9":"(",
"0":")",
"-":"_",
"=":"+",
";":":",
"'":"\"",
",":"<",
".":">",
"/":"?",
"\\":"|"
}
//Special Keys - and their codes
var special_keys = {
'esc':27,
'escape':27,
'tab':9,
'space':32,
'return':13,
'enter':13,
'backspace':8,
'scrolllock':145,
'scroll_lock':145,
'scroll':145,
'capslock':20,
'caps_lock':20,
'caps':20,
'numlock':144,
'num_lock':144,
'num':144,
'pause':19,
'break':19,
'insert':45,
'home':36,
'delete':46,
'end':35,
'pageup':33,
'page_up':33,
'pu':33,
'pagedown':34,
'page_down':34,
'pd':34,
'left':37,
'up':38,
'right':39,
'down':40,
'f1':112,
'f2':113,
'f3':114,
'f4':115,
'f5':116,
'f6':117,
'f7':118,
'f8':119,
'f9':120,
'f10':121,
'f11':122,
'f12':123
}
var modifiers = {
shift: { wanted:false, pressed:false},
ctrl : { wanted:false, pressed:false},
alt : { wanted:false, pressed:false},
meta : { wanted:false, pressed:false} //Meta is Mac specific
};
if(e.ctrlKey) modifiers.ctrl.pressed = true;
if(e.shiftKey) modifiers.shift.pressed = true;
if(e.altKey) modifiers.alt.pressed = true;
if(e.metaKey) modifiers.meta.pressed = true;
for(var i=0; k=keys[i],i 1) { //If it is a special key
if(special_keys[k] == code) kp++;
} else if(opt['keycode']) {
if(opt['keycode'] == code) kp++;
} else { //The special keys did not match
if(character == k) kp++;
else {
if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
character = shift_nums[character];
if(character == k) kp++;
}
}
}
}
if(kp == keys.length &&
modifiers.ctrl.pressed == modifiers.ctrl.wanted &&
modifiers.shift.pressed == modifiers.shift.wanted &&
modifiers.alt.pressed == modifiers.alt.wanted &&
modifiers.meta.pressed == modifiers.meta.wanted) {
callback(e);
if(!opt['propagate']) { //Stop the event
//e.cancelBubble is supported by IE - this will kill the bubbling process.
e.cancelBubble = true;
e.returnValue = false;
//e.stopPropagation works in Firefox.
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
return false;
}
}
}
this.all_shortcuts[shortcut_combination] = {
'callback':func,
'target':ele,
'event': opt['type']
};
//Attach the function with the event
if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
else ele['on'+opt['type']] = func;
},
//Remove the shortcut - just specify the shortcut and I will remove the binding
'remove':function(shortcut_combination) {
shortcut_combination = shortcut_combination.toLowerCase();
var binding = this.all_shortcuts[shortcut_combination];
delete(this.all_shortcuts[shortcut_combination])
if(!binding) return;
var type = binding['event'];
var ele = binding['target'];
var callback = binding['callback'];
if(ele.detachEvent) ele.detachEvent('on'+type, callback);
else if(ele.removeEventListener) ele.removeEventListener(type, callback, false);
else ele['on'+type] = false;
}
}