Skip to content
Snippets Groups Projects
Commit 8cc02d2f authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Some JS cleanup, keep accesskeys working for hidden pickers FS#1761

Ignore-this: 3b6c8568615d24be7115adf8570f56bd

darcs-hash:20091017180329-7ad00-9ff4a12c811f1a4c63e473dc6665928fda720850.gz
parent 31f197d7
No related branches found
No related tags found
No related merge requests found
/**
* Functions for text editing (toolbar stuff)
*
* @todo I'm no JS guru please help if you know how to improve
* @todo most of the stuff in here should be revamped and then moved to toolbar.js
* @author Andreas Gohr <andi@splitbrain.org>
*/
......@@ -67,7 +67,7 @@ function createPicker(id,props,edid){
}
picker.id = id;
picker.style.position = 'absolute';
picker.style.display = 'none';
picker.style.left = '-10000px'; // no display none, to keep access keys working
for(var key in list){
if (!list.hasOwnProperty(key)) continue;
......@@ -123,24 +123,6 @@ function pickerInsert(text,edid){
pickerClose();
}
/**
* Show a previosly created picker window
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function showPicker(pickerid,btn){
var picker = document.getElementById(pickerid);
var x = findPosX(btn);
var y = findPosY(btn);
if(picker.style.display == 'none'){
picker.style.display = 'block';
picker.style.left = (x+3)+'px';
picker.style.top = (y+btn.offsetHeight+3)+'px';
}else{
picker.style.display = 'none';
}
}
/**
* Add button action for signature button
*
......@@ -162,7 +144,6 @@ function addBtnActionSignature(btn, props, edid)
return false;
}
/**
* Add button action for the mediapopup button
*
......@@ -171,8 +152,7 @@ function addBtnActionSignature(btn, props, edid)
* @return boolean If button should be appended
* @author Gabriel Birke <birke@d-scribe.de>
*/
function addBtnActionMediapopup(btn, props)
{
function addBtnActionMediapopup(btn, props) {
eval("btn.onclick = function(){window.open('"+DOKU_BASE+
jsEscape(props['url']+encodeURIComponent(NS))+"','"+
jsEscape(props['name'])+"','"+
......@@ -181,8 +161,15 @@ function addBtnActionMediapopup(btn, props)
return true;
}
function addBtnActionAutohead(btn, props, edid, id)
{
/**
* Add button action for the headline buttons
*
* @param DOMElement btn Button element to add the action to
* @param array props Associative array of button properties
* @return boolean If button should be appended
* @author Andreas Gohr <gohr@cosmocode.de>
*/
function addBtnActionAutohead(btn, props, edid, id) {
eval("btn.onclick = function(){"+
"insertHeadline('"+edid+"',"+props['mod']+",'"+jsEscape(props['text'])+"'); "+
"return false};");
......
......@@ -158,6 +158,15 @@ function addBtnActionPicker(btn, props, edid) {
return true;
}
/**
* Add button action for the link wizard button
*
* @param DOMElement btn Button element to add the action to
* @param array props Associative array of button properties
* @param string edid ID of the editor textarea
* @return boolean If button should be appended
* @author Andreas Gohr <gohr@cosmocode.de>
*/
function addBtnActionLinkwiz(btn, props, edid) {
linkwiz.init($(edid));
addEvent(btn,'click',function(){
......@@ -167,7 +176,6 @@ function addBtnActionLinkwiz(btn, props, edid) {
return true;
}
/**
* Show/Hide a previosly created picker window
*
......@@ -175,14 +183,13 @@ function addBtnActionLinkwiz(btn, props, edid) {
*/
function pickerToggle(pickerid,btn){
var picker = $(pickerid);
if(picker.style.display == 'none'){
if(picker.style.left == '-10000px'){
var x = findPosX(btn);
var y = findPosY(btn);
picker.style.display = 'block';
picker.style.left = (x+3)+'px';
picker.style.top = (y+btn.offsetHeight+3)+'px';
}else{
picker.style.display = 'none';
picker.style.left = '-10000px';
}
}
......@@ -194,7 +201,7 @@ function pickerToggle(pickerid,btn){
function pickerClose(){
var pobjs = getElementsByClass('picker');
for(var i=0; i<pobjs.length; i++){
pobjs[i].style.display = 'none';
pobjs[i].style.left = '-10000px';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment