sf-static/sql/js/min/ehelp.js

22 lines
11 KiB
JavaScript
Raw Permalink Normal View History

2023-02-28 18:21:07 +00:00
(function(a){a.fn.extend({embeddedHelp:function(v,r){function z(){var b,e={height:window.innerHeight,width:window.innerWidth};e.height||!(b=document.compatMode)&&a.support.boxModel||(b="CSS1Compat"==b?document.documentElement:document.body,e={height:b.clientHeight,width:b.clientWidth});return e}function A(){return{top:window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,left:window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft}}function w(){return{height:a(document).height(),
width:a(document).width()}}function G(a){return{height:a.height(),width:a.width()}}function D(a,e){var c=w();return(a>c.width/2?"L":"R")+(e>c.height/2?"T":"B")}function B(){a(".EHtoolgost").remove();a(".EHtooltipc").each(function(b){var e=a(this);b=e.offset();var c=e.outerWidth(),f=e.outerHeight(),d=w(),g=z(),h=A(),q=h.top,h=h.left,n=q+g.height,p=h+g.width,e=e.find("span").html(),k=!1;if(d.width>g.width)var m=50,l=!0;else m=35,l=!1;d.height>g.height?(d=50,g=!0):(d=35,g=!1);b.top>n?(f=n-m,k=!0):1==
l&&b.top>n-20?(f=n-m,k=!0):b.top+f<q?(f=q,k=!0):f=b.top;b.left+c<h?(b=h+10,k=!0):1==g&&b.left+c<h-20?(b=h+10,k=!0):b.left>p?(b=p-d,k=!0):b=b.left;1==k&&(c=a("<div>").addClass("EHtoolgost").html("<span>"+e+"</span>").appendTo("body"),1!=H(e,f,b,c.outerHeight(),c.outerWidth())&&c.attr("id","ghost_"+e).css("top",f+5+"px").css("left",b-5+"px").appendTo("body").fadeIn("slow"))});return!1}function I(){J(a("#EHpointer"));return!1}function H(b,e,c,f,d){z();A();var g=!1;a(".EHtoolgost").each(function(h){h=
a(this).offset();var q=a(this).outerWidth(),n=a(this).outerHeight(),p=a(this).find("span").html();p!=b&&""!=p&&(c>=h.left&&c<=h.left+q||c+d>=h.left&&c+d<=h.left+q)&&(e>=h.top&&e<=h.top+n||e+f>=h.top&&e+f<=h.top+n)&&(a(this).find("span").html(p+", "+b),g=!0)});return g}function J(b){var e=b.offset(),c=b.height();b=b.width();var f=z(),d=A(),g=d.top,d=d.left,h=g+f.height,q=d+f.width,n=w(),p=!1,k=!1,m=a.browser.opera?"html":"body,html";if(0<b){if(e.top+c>h){var l=g+f.height;l+f.height>n.height&&(l=n.height-
f.height);g!=l&&(p=!0)}else e.top<g&&(l=g-f.height,0>l&&(l=0),g!=l&&(p=!0));if(e.left<d){var t=d-f.width;0>d&&(d=0);d!=t&&(k=!0)}else e.left+b>q&&(t=d+f.width,t+f.width>n.width&&(t=n.width-f.width),d!=t&&(k=!0));1==p&&1!=u&&(u=!0,a(m).animate({scrollTop:l},"slow",function(a){u=!1}));1==k&&1!=u&&(u=!0,a(m).animate({scrollLeft:t},"slow",function(a){u=!1}))}return!1}function C(b){1==r.callextf&&""!=b.extf&&void 0!=b.extf&&(a[b.extf]?(b.object=a(b.element),a[b.extf](b)):jQuery.globalEval(b.extf));return!1}
function x(){clearInterval(E);y=null;a("#EHpointer").stop(!0);a("#EHtooltip").stop();a(".EHtooltmp").remove();a("#EHtooltip").remove();a("#EHpointer").remove();a(".EHtooltipc").remove();a(".EHtoolgost").remove();a.isEmptyObject(v)||a.each(v,function(b,e){a.each(e.path,function(b,e){a(e.element).removeClass(e.marker)})});return!1}function K(b,e){var c=b.offset();w();var f=e.length;if(!a.isEmptyObject(e)){a("body").append("<div id='EHtooltip'></div>");a("body").append("<div id='EHpointer'></div>");
a("#EHpointer").css("top",c.top+10+"px").css("left",c.left+10+"px").fadeIn("fast");var d=0;(function(){var b=e[d++],c=arguments.callee,q=a(b.element).offset(),n=a(b.element).height(),p=a(b.element).width(),k=q.left+p/2,m=q.top+n/2,l=G(a("#EHpointer"));a("#EHpointer").animate({left:k+"px",top:m+"px"},1E3,function(e){a(b.element).addClass(b.marker);e=a("#EHtooltip").css("width","auto");e.html(b.desc);"E"!=b.ftriger&&C(b);var c=e.width(),d=e.height();tbalign=1!=r.autoalign&&""!=b.align?b.align:D(k+5,
m+5);switch(tbalign){case "L":topset=m;leftset=k-c-5;break;case "LT":topset=m-d-5;leftset=k-c-5;break;case "LB":topset=m+d+5;leftset=k-c-5;break;case "R":topset=m;leftset=k+l.width+5;break;case "RT":topset=m-5;leftset=k+l.width+5;break;case "RB":topset=m+l.height+5,leftset=k+l.width+5}e.css("top",topset+"px").css("left",leftset+"px").css("width",c+"px").fadeIn("fast").delay(b.duration).queue(function(){a(this).dequeue()})}).delay(b.duration).queue(function(){a(b.element).removeClass(b.marker);"E"==
b.ftriger&&C(b);d>=f&&(a("#EHtooltip").remove(),a("#EHpointer").remove(),clearInterval());a(this).dequeue()}).fadeTo(1,1,c)})()}1==r.animatedvp&&(E=setInterval(I,250));return!1}function F(b){a(".EHtooltipc").remove();a(".EHtooltmp").remove();w();a.isEmptyObject(b)||a.each(b,function(b,c){var f=a(c.element).offset(),d=a(c.element).height(),g=a(c.element).width(),g=f.left+g/2,f=f.top+d/2,d="<span>"+(b+1)+"</span>";tbalign=1!=r.autoalign&&""!=c.align?c.align:D(g+5,f+5);a("<div>").addClass("EHtooltipc").html(d).attr("rel",
tbalign).attr("alt",c.desc).css("top",f+5+"px").css("left",g+5+"px").appendTo("body").fadeIn("slow");C(c)});return 1==r.staticvp?B():!1}function L(b){a.isEmptyObject(b)||a.each(b,function(b,c){a("#EHhelpBox").append("<a rel='"+c.rel+"' href=''>"+c.link+"</a><br/>")})}var y,u,E;r=a.extend({animatedvp:!0,staticvp:!0,autoalign:!0,callextf:!0,autolinks:!0},r);return this.each(function(){var b=a(this),b=a("a[rel]",b);1==r.autolinks&&L(v);b.live("click",function(){var b=a(this),c=a(this).attr("rel");x();
a.isEmptyObject(v)||a.each(v,function(a,d){d.rel==c&&("animated"==d.method?K(b,d.path):(F(d.path),y=d.path))});return!1});a(".EHclose").live("click",function(){a(".EHtooltipc").fadeOut("slow").remove();x();return!1});a(".EHstopAll").live("click",function(){x();return!1});a(".EHtooltmp").live("mouseleave",function(){a(this).remove()});a(".EHtooltipc").live("mouseover",function(){a(".EHtooltmp").remove();var b=a(this).attr("rel"),c=a(this).offset(),f=a(this).outerWidth();a(this).outerHeight();var d=
a(this).find("span").html(),d=y[d-1].desc;switch(b){case "L":case "LT":case "LB":b=a("<div>").addClass("EHtooltmp").html("<p>"+d+"</p><a href='' class='EHclose'>X</a>").appendTo("body");tmpboxWidth=b.width();tmpboxHeight=b.height();b.css("top",c.top+"px").css("left",c.left-tmpboxWidth+"px").css("width",tmpboxWidth+"px").css("border-right","0px").fadeIn("slow");break;case "R":case "RT":case "RB":b=a("<div>").addClass("EHtooltmp").html("<p>"+d+"</p><a href='' class='EHclose'>X</a>").appendTo("body"),
tmpboxWidth=b.width(),tmpboxHeight=b.height(),b.css("top",c.top+"px").css("left",c.left+f+"px").css("width",tmpboxWidth+"px").css("border-left","0px").fadeIn("slow")}});a(window).resize(function(){F(y);1==r.staticvp&&B()});a(window).scroll(function(){1==r.staticvp&&B()});a(window).keydown(function(a){"27"!=a.keyCode&&"27"!=a.which||x()});a(document).keydown(function(a){"27"!=a.keyCode&&"27"!=a.which||x()})})}})})(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:4E3,align:"LT",marker:"EHpointer"},{element:"#dblist",desc:"List of databases on the server. Selection shows the database you are currently working with.",duration:4E3,align:"LT",marker:"EHpointer"},{element:"#object_list",desc:"Database objects e.g. tables, views, functions are displayed here",duration:4E3,align:"LT",marker:"EHpointer"},
{element:"#screenContent",desc:"Content area contains query results, success/error messages and other information",duration:4E3,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:6E3,align:"LT",marker:"EHpointer"},{element:"#nav_bar",desc:"Buttons for performing various result related operations.<br />As you work with results, additional buttons appear here based on the editing state of results",
duration:8E3,align:"LT",marker:"EHpointer"}]},{rel:"queries",method:"animated",path:[{element:"#sqlEditFrame",desc:"Type sql query in one of the sql editors, or select a part of the text to be executed as a query",duration:4E3,align:"LT",marker:"EHpointer"},{element:"#nav_query",desc:"Click on the [Query] button, or press Ctrl+Enter to run the query",duration:3E3,align:"LT",marker:"EHpointer"},{element:"#nav_queryall",desc:"To execute multiple queries at once, Click [Query All] or press Ctrl+Shift+Enter",
duration:3E3,align:"LT",marker:"EHpointer"},{element:"#screenContent",desc:"Successful query results will show up in the result pane<br />If an error occurs, the error will be shown in the messages pane",duration:6E3,align:"LT",marker:"EHpointer"}]},{rel:"editing_results",method:"animated",path:[{element:"#screenContent",desc:"Once results appear in the results pane after a query or table selection, you can:<br />- Sort the results by clicking the column headers<br />- Use the checkboxes in second column to select records for deletion<br />- Double click a cell to edit its value<br />- Use the [Add Record] button to add a new record (which can be later saved by [Update records] button)",
duration:1E4,align:"R",marker:"EHpointer"},{element:"#nav_bar",desc:"Once you have selected/edited the records you want to update, use one of the buttons on the navigation bar to perform an operation",duration:5E3,align:"L",marker:"EHpointer"},{element:"#nav_bar",desc:"Press [Update records] to generate and execute update queries for edited records",duration:4E3,align:"L",marker:"EHpointer"},{element:"#nav_bar",desc:"Press [Delete records] to generate and execute queries to delete selected records",
duration:4E3,align:"L",marker:"EHpointer"},{element:"#nav_bar",desc:"Press [Generate SQL] to only generate update/delete queries. You can then inspect the generated sql text and execute as desired after any modification",duration:1E4,align:"L",marker:"EHpointer"},{element:"#screenContent",desc:"Success/error messages and affected records will be shown in the messages pane",duration:5E3,align:"L",marker:"EHpointer"}]},{rel:"objects",method:"animated",path:[{element:"#object_list",desc:"Click on any of the objects in the database to perform default action.<br />Clicking on tables/views shows their data in the results pane.<br />For other objects, their creation command is shown by default",
duration:1E4,align:"LT",marker:"EHpointer"},{element:"#object_list",desc:"Right click on any object to see a list of commands that can be performed on that object",duration:8E3,align:"LT",marker:"EHpointer"},{element:"#object_list",desc:"Some of the commands generate sql queries when executed, which are then automatically added to the first sql editor",duration:7E3,align:"LT",marker:"EHpointer"}]}],showEHelp=function(){$("body").append('<div id="EHhelpOverlay" class="ui-widget-overlay"></div><div id="EHhelpBox" class="ui-widget-header"><p class="title">Quickstart Tutorials</p><a rel="interface" href="#">Introduction to interface elements</a><a rel="queries" href="#">Performing queries</a><a rel="editing_results" href="#">Editing and saving results</a><a rel="objects" href="#">Working with database objects</a><a id="EHstopAll" class="EHstopAll" href="#">Close Tutorial</a></div>');
$("#EHhelpBox").embeddedHelp(ehelp_topics,{animatedvp:!0,staticvp:!0,autoalign:!0,autolinks:!1});$("#EHstopAll").click(function(a){$("#EHhelpOverlay,#EHhelpBox").remove();$("#ehelp_css").remove()});$("#EHhelpBox").one("click",function(){$(this).animate({top:"3%",right:"3%"})})};