From 4e065dffcd51573c630c150429d238a8f6b2c3ed Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 3 Sep 2012 12:48:09 +0200 Subject: [PATCH] glossary popup improvements see BT#4391 --- main/document/showinframes.php | 8 +- .../glossary/fck_glossary_automatic.js | 6 +- .../plugins/glossary/fck_glossary_manual.js | 80 +++++++++++++------ 3 files changed, 60 insertions(+), 34 deletions(-) diff --git a/main/document/showinframes.php b/main/document/showinframes.php index 7a53a4fd53..9f4eb7c2f6 100644 --- a/main/document/showinframes.php +++ b/main/document/showinframes.php @@ -150,9 +150,11 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual') { // $("
I am a div courses
").prependTo("body"); }, "top.mainFrame", { load: [ - {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"}, - {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"}, - {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/glossary/fck_glossary_manual.js"} + {type:"script", id:"_fr1", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js"}, + {type:"script", id:"_fr4", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"}, + {type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"}, + {type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"}, + {type:"script", id:"_fr3", src:"'.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/glossary/fck_glossary_manual.js"} ] } ); diff --git a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js index 5eea1b0d9f..eca997f753 100644 --- a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js +++ b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js @@ -78,11 +78,7 @@ //$("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;"); //$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;"); - //my_position = $(this).position(); - - var $target = $(this); - - //alert(my_position.left +' + '+ my_position.top +' +' + $(this).offset().left); + var $target = $(this); $("#"+div_show_id).dialog("destroy"); $("#"+div_show_id).dialog({ diff --git a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js index 163d85f825..171fd0345f 100644 --- a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js +++ b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js @@ -7,39 +7,67 @@ document/showinframes.php newscorm/lp_view.php newscorm/scorm_api.php -*/ + */ //$(document).ready(function() { // $(window).load(function () { - my_protocol = location.protocol; - my_pathname=location.pathname; - work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); - $("body .glossary").mouseover(function(){ - is_glossary_name = $(this).html(); - random_id = Math.round(Math.random()*100); - div_show_id="div_show_id"+random_id; - div_content_id="div_content_id"+random_id; - $(this).append("
 
"); - $("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;"); - $("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;"); - - $.ajax({ - contentType: "application/x-www-form-urlencoded", - beforeSend: function(result) { - $("div#"+div_content_id).html(""); }, - }, - type: "POST", - url: "../../../../../../../main/glossary/glossary_ajax_request.php", - data: "glossary_name="+is_glossary_name, - success: function(data) { - $("div#"+div_content_id).html(data); - } - }); - }); + my_protocol = location.protocol; + my_pathname=location.pathname; + work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); + + //$("body .glossary").mouseover(function(){ + $("body").on("click", ".glossary", function() { + is_glossary_name = $(this).html(); + random_id = Math.round(Math.random()*100); + + /*div_show_id="div_show_id"+random_id; + div_content_id="div_content_id"+random_id;*/ + + div_show_id="div_show_id"; + div_content_id="div_content_id"; + + $(this).append("
 
"); + + var $target = $(this); + + $("#"+div_show_id).dialog("destroy"); + $("#"+div_show_id).dialog({ + autoOpen: false, + width: 600, + height: 200, + position: { my: 'left top', at: 'right top', of: $target }, + close: function(){ + $("div#"+div_show_id).remove(); + $("div#"+div_content_id).remove(); + } + }); + + + + /* $("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;"); + $("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");*/ + + $.ajax({ + contentType: "application/x-www-form-urlencoded", + beforeSend: function(result) { + $("div#"+div_content_id).html(""); + }, + type: "POST", + url: "../../../../../../../main/glossary/glossary_ajax_request.php", + data: "glossary_name="+is_glossary_name, + success: function(data) { + $("div#"+div_content_id).html(data); + $("#"+div_show_id).dialog("open"); + } + }); + }); + +/* $("body .glossary").mouseout(function(){ current_element=$(this); div_show_id=current_element.find("div").attr("id"); $("div#"+div_show_id).remove(); }); +*/ // }); //});