/* * EmbeddedHelp v1.1.4 - jQuery help plugin * file: jquery.ehelp-1.1.4.js * Copyright (c) 2011 Josip Kalebic * josip.kalebic@gmail.com, www.embedded-help.net * improved by ckszabi@gmail.com * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Paths definition: [{ 'rel':'rel_name', 'method':'static or animated', 'path': [{ 'element': 'jquery selector', 'desc': 'Help content (tooltip)', 'duration': number in ms, "align": position of tooltip, 'marker': 'class to mark element on page', 'extf' : external function 'ftriger': call external function at beginning or end 'B' or 'E' 'value': value used by external function }] }]; //--------------------------------------------------------- extf: calls external function two methods: - javascript function - examp: "diferentWay('#search','My phrase')" whole string going throu $.globalEval - jquery function - examp: "userValueF" - parameters are send in form of object - whole path elements are send into function //--------------------------------------------------------- 'ftriger': call external function at beginning or end - options: 'B' or 'E' - default: 'B' - used for animated method only //--------------------------------------------------------- align: the position of the tip. Possible values are LT left top LB left bottom RT right top RB right bottom R right L left //--------------------------------------------------------- OPTIONS: default values 'animatedvp': true, -> viewport traction on animated method 'staticvp': true, -> viewport traction on static method 'autoalign':true -> align of tooltips true -> positioned by script, false -> poistioned by "align" value in paths definition 'autolinks':true -> generates help links from json paths definitions //--------------------------------------------- */ (function($){ $.fn.extend({ embeddedHelp: function(pathdefinition, options) { var pathdefinition; var activeStaticPath; var Ghost; var ViewportOnMove; var Htimer; var options = $.extend({ 'animatedvp': true, 'staticvp': true, 'autoalign':true, 'callextf':true, 'autolinks':true }, options); //-------------------------------------------------- function getViewportSize() { var mode, domObject, size = { height: window.innerHeight, width: window.innerWidth }; // if this is correct then return it. iPad has compat Mode, so will // go into check clientHeight/clientWidth (which has the wrong value). if (!size.height) { mode = document.compatMode; if (mode || !$.support.boxModel) { // IE, Gecko domObject = mode == 'CSS1Compat' ? document.documentElement : // Standards document.body; // Quirks size = { height: domObject.clientHeight, width: domObject.clientWidth }; } } return size; } //-------------------------------------------------- function getViewportOffset() { return { top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop, left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft }; } //-------------------------------------------------- function getDocumentSize() { return { height: $(document).height(), width: $(document).width() }; } //-------------------------------------------------- function getElementSize($element) { return { height: $element.height(), width: $element.width() }; } //---------------------------------------------------- function getAutoAlign(leftx, topy) { var doffset = getDocumentSize(); var dhalfheight = (doffset.height / 2); var dhalfwidth = (doffset.width / 2); if(leftx > dhalfwidth) { var algl = 'L'; } else { var algl = 'R'; } if(topy > dhalfheight) { var algt = 'T'; } else { var algt = 'B'; } return (algl + algt); } //----------------------------------- function checkAllStaticBoxes() { $('.EHtoolgost').remove(); $('.EHtooltipc').each(function(index) { setView($(this)); }); return false; } //----------------------------------- function checkPointer() { doSetViewport($('#EHpointer')); return false; } //----------------------------------------- function compareOtherGhosts(bnumber, btop, bleft, bheight, bwidth) { var difftop = 0; var diffleft = 0; var vpSize = getViewportSize(); var vpOffset = getViewportOffset(); var wtop = vpOffset.top; var wleft = vpOffset.left; var wbottom = wtop + vpSize.height; var wright = wleft + vpSize.width; var conflict = false; var conflictnumbers = ""; $('.EHtoolgost').each(function(index) { var toffset = $(this).offset(); var twidth = $(this).outerWidth(); var theight = $(this).outerHeight(); var tnumber = $(this).find('span').html(); if(tnumber != bnumber && tnumber != "") { if((bleft >= toffset.left && bleft <= (toffset.left + twidth)) || ((bleft + bwidth) >= toffset.left && (bleft + bwidth) <= (toffset.left + twidth))) { if((btop >= toffset.top && btop <= (toffset.top + theight)) || ((btop + bheight) >= toffset.top && (btop + bheight) <= (toffset.top + theight))) { $(this).find('span').html(tnumber + ", " + bnumber); conflict = true; } } } }); return conflict; } //----------------------------------- function setView(that) { var poffset = that.offset(); var pwidth = that.outerWidth(); var pheight = that.outerHeight(); var dSize = getDocumentSize(); var vpSize = getViewportSize(); var vpOffset = getViewportOffset(); var wtop = vpOffset.top; var wleft = vpOffset.left; var wbottom = wtop + vpSize.height; var wright = wleft + vpSize.width; var number = that.find('span').html(); var boxtext = ""; var doGhost = false; //check if bottom scrollbar appears if(dSize.width > vpSize.width) { var bootom_margin = 50; var horizontalscrollbar = true; } else { var bootom_margin = 35; var horizontalscrollbar = false; } //check if right scrollbar appears if(dSize.height > vpSize.height) { var right_margin = 50; var verticalscrollbar = true; } else { var right_margin = 35; var verticalscrollbar = false; } if(poffset.top > wbottom) { var newtop = (wbottom - bootom_margin); doGhost = true; } else if(horizontalscrollbar == true && poffset.top > (wbottom - 20)) { var newtop = (wbottom - bootom_margin); doGhost = true; } else if((poffset.top + pheight) < wtop) { var newtop = (wtop); doGhost = true; } else { var newtop = poffset.top; } if((poffset.left + pwidth) < wleft) { var newleft = (wleft + 10); doGhost = true; } else if(verticalscrollbar == true && (poffset.left + pwidth) < (wleft - 20)) { var newleft = (wleft + 10); doGhost = true; } else if(poffset.left > wright) { var newleft = (wright - right_margin); doGhost = true; } else { var newleft = poffset.left; } if(doGhost == true) { var GhostBox = $("
" + textdesc + "
X").appendTo("body"); tmpboxWidth = tmpbox.width(); tmpboxHeight = tmpbox.height(); tmpbox.css("top",(toffset.top) + "px").css("left",(toffset.left - tmpboxWidth) + "px").css("width",tmpboxWidth + "px").css("border-right", "0px").fadeIn("slow"); break; case "R": case "RT": case "RB": var tmpbox = $("" + textdesc + "
X").appendTo("body"); tmpboxWidth = tmpbox.width(); tmpboxHeight = tmpbox.height(); tmpbox.css("top",(toffset.top) + "px").css("left",(toffset.left + towidth) + "px").css("width",tmpboxWidth + "px").css("border-left", "0px").fadeIn("slow"); break; } }); //-------------------------------------------------------------- $(window).resize( function () { doPathStatic(activeStaticPath); if(options.staticvp == true) { checkAllStaticBoxes(); } }); $(window).scroll( function () { if(options.staticvp == true) { checkAllStaticBoxes(); } }); $(window).keydown(function(e) { if (e.keyCode == '27' || e.which == '27') { doClearAll(); } }); $(document).keydown(function(e) { if (e.keyCode == '27' || e.which == '27') { doClearAll(); } }); //----------------------------------- }); } }); })(jQuery); var ehelp_topics = [ { "rel":"interface", "method":"animated", "path": [ { "element": "#toolbarHolder", "desc": "Application main menu. Hover your mouse over options to see various commands", "duration": 4000, "align": "LT", "marker": "EHpointer" }, { "element": "#dblist", "desc": "List of databases on the server. Selection shows the database you are currently working with.", "duration": 4000, "align": "LT", "marker": "EHpointer" }, { "element": "#object_list", "desc": "Database objects e.g. tables, views, functions are displayed here", "duration": 4000, "align": "LT", "marker": "EHpointer" }, { "element": "#screenContent", "desc": "Content area contains query results, success/error messages and other information", "duration": 4000, "align": "LT", "marker": "EHpointer" }, { "element": "#sqlEditFrame", "desc": "Multiple Sql Editors. You can switch between the editors by shortcuts keys to work with multiple queries without overwriting them", "duration": 6000, "align": "LT", "marker": "EHpointer" }, { "element": "#nav_bar", "desc": "Buttons for performing various result related operations.