diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2011-04-02 03:36:26 +0100 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2011-04-02 03:36:26 +0100 |
commit | efb973f8a33b893d0a4d46d6b733530833c4ad41 (patch) | |
tree | 9386f06b90a4fc6a5c31183793df17851ca0da26 /lib/scripts | |
parent | 344763ad4e90e41c8a94b0a69a527ff2d6319ab5 (diff) | |
parent | a3f9f75c2624b73c4a57bf2a346ae71bf6a5fb98 (diff) | |
download | rpg-efb973f8a33b893d0a4d46d6b733530833c4ad41.tar.gz rpg-efb973f8a33b893d0a4d46d6b733530833c4ad41.tar.bz2 |
Merge branch 'master' of git@github.com:splitbrain/dokuwiki
Diffstat (limited to 'lib/scripts')
-rw-r--r-- | lib/scripts/locktimer.js | 2 | ||||
-rw-r--r-- | lib/scripts/media.js | 4 | ||||
-rw-r--r-- | lib/scripts/script.js | 42 | ||||
-rw-r--r-- | lib/scripts/toolbar.js | 2 |
4 files changed, 44 insertions, 6 deletions
diff --git a/lib/scripts/locktimer.js b/lib/scripts/locktimer.js index 51d533056..f5ba1c60d 100644 --- a/lib/scripts/locktimer.js +++ b/lib/scripts/locktimer.js @@ -94,6 +94,6 @@ var locktimer = { $('draft__status').innerHTML=data; if(error != '1') return; // locking failed locktimer.reset(); - }, + } }; diff --git a/lib/scripts/media.js b/lib/scripts/media.js index b90f7047b..57f599163 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -536,7 +536,9 @@ var media_manager = { } } } - opener.insertTags('wiki__text','{{'+alignleft+id+opts+alignright+'|','}}',''); + var edid = String.prototype.match.call(document.location, /&edid=([^&]+)/); + edid = edid ? edid[1] : 'wiki__text'; + opener.insertTags(edid,'{{'+alignleft+id+opts+alignright+'|','}}',''); if(!media_manager.keepopen) window.close(); opener.focus(); diff --git a/lib/scripts/script.js b/lib/scripts/script.js index b9b324f96..2cc1246f9 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -114,6 +114,20 @@ function findPosY(object){ } //end findPosY function /** + * Get the computed style of a node. + * + * @link https://acidmartin.wordpress.com/2008/08/26/style-get-any-css-property-value-of-an-object/ + * @link http://svn.dojotoolkit.org/src/dojo/trunk/_base/html.js + */ +function gcs(node){ + if(node.currentStyle){ + return node.currentStyle; + }else{ + return node.ownerDocument.defaultView.getComputedStyle(node, null); + } +} + +/** * Escape special chars in JavaScript * * @author Andreas Gohr <andi@splitbrain.org> @@ -260,10 +274,32 @@ function insitu_popup(target, popup_id) { getElementsByClass('dokuwiki', document.body, 'div')[0].appendChild(fndiv); } + var non_static_parent = fndiv.parentNode; + while (non_static_parent != document && gcs(non_static_parent)['position'] == 'static') { + non_static_parent = non_static_parent.parentNode; + } + + var fixed_target_parent = target; + while (fixed_target_parent != document && gcs(fixed_target_parent)['position'] != 'fixed') { + fixed_target_parent = fixed_target_parent.parentNode; + } + // position the div and make it visible - fndiv.style.position = 'absolute'; - fndiv.style.left = findPosX(target)+'px'; - fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5) + 'px'; + if (fixed_target_parent != document) { + // the target has position fixed, that means the footnote needs to be fixed, too + fndiv.style.position = 'fixed'; + } else { + fndiv.style.position = 'absolute'; + } + + if (fixed_target_parent != document || non_static_parent == document) { + fndiv.style.left = findPosX(target)+'px'; + fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5) + 'px'; + } else { + fndiv.style.left = (findPosX(target) - findPosX(non_static_parent)) +'px'; + fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5 - findPosY(non_static_parent)) + 'px'; + } + fndiv.style.display = ''; return fndiv; } diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js index 3f967448c..d458960ab 100644 --- a/lib/scripts/toolbar.js +++ b/lib/scripts/toolbar.js @@ -153,7 +153,7 @@ function tb_insert(btn, props, edid) { */ function tb_mediapopup(btn, props, edid) { window.open( - DOKU_BASE+props['url']+encodeURIComponent(NS), + DOKU_BASE+props['url']+encodeURIComponent(NS)+'&edid='+encodeURIComponent(edid), props['name'], props['options']); return false; |