aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/scripts/script.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-02-23 22:04:12 +0100
committerAndreas Gohr <andi@splitbrain.org>2006-02-23 22:04:12 +0100
commit389db369c7d10fb29a95e08db4c878a91aa1d283 (patch)
tree742948e0777ad67969e8ceb1570e54aad156cf6d /lib/scripts/script.js
parent0affd4885a0f1ff95446097f3faa5bcf1a519a25 (diff)
downloaddokuwiki-389db369c7d10fb29a95e08db4c878a91aa1d283.tar.gz
dokuwiki-389db369c7d10fb29a95e08db4c878a91aa1d283.zip
small enhancement for image insertion as suggested by Bob Baddeley
darcs-hash:20060223210412-7ad00-725252ab13b08d01569f13fabdffbdc3b0334676.gz
Diffstat (limited to 'lib/scripts/script.js')
-rw-r--r--lib/scripts/script.js62
1 files changed, 31 insertions, 31 deletions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index d2fbc35bf..d621232ce 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -117,11 +117,11 @@ function escapeQuotes(text) {
* @see appendChild()
*/
function prependChild(parent,element) {
- if(!parent.firstChild){
- parent.appendChild(element);
- }else{
- parent.insertBefore(element,parent.firstChild);
- }
+ if(!parent.firstChild){
+ parent.appendChild(element);
+ }else{
+ parent.insertBefore(element,parent.firstChild);
+ }
}
/**
@@ -153,8 +153,8 @@ function hideLoadBar(){
* @see http://www.alexking.org/index.php?content=software/javascript/content.php
*/
function mediaSelect(file){
- opener.insertAtCarret('wikitext','{{'+file+'}}');
- window.close();
+ opener.insertTags('wikitext','{{'+file+'|','}}',file);
+ window.close();
}
/**
@@ -173,23 +173,23 @@ function suggestWikiname(){
* Adds the toggle switch to the TOC
*/
function addTocToggle() {
- if(!document.getElementById) return;
- var header = $('toc__header');
+ if(!document.getElementById) return;
+ var header = $('toc__header');
if(!header) return;
var showimg = document.createElement('img');
- showimg.id = 'toc__show';
+ showimg.id = 'toc__show';
showimg.src = DOKU_BASE+'lib/images/arrow_down.gif';
showimg.alt = '+';
- showimg.onclick = toggleToc;
+ showimg.onclick = toggleToc;
showimg.style.display = 'none';
- var hideimg = document.createElement('img');
- hideimg.id = 'toc__hide';
+ var hideimg = document.createElement('img');
+ hideimg.id = 'toc__hide';
hideimg.src = DOKU_BASE+'lib/images/arrow_up.gif';
hideimg.alt = '-';
- hideimg.onclick = toggleToc;
-
+ hideimg.onclick = toggleToc;
+
prependChild(header,showimg);
prependChild(header,hideimg);
}
@@ -289,7 +289,7 @@ function checkAclLevel(){
*
* provide a wrapper for domTT javascript library
* this function is placed in the onmouseover event of footnote references in the main page
- *
+ *
* @author Chris Smith <chris [at] jalakai [dot] co [dot] uk>
*/
var currentFootnote = 0;
@@ -298,33 +298,33 @@ function fnt(id, e, evt) {
if (currentFootnote && id != currentFootnote) {
domTT_close($('insitu-fn'+currentFootnote));
}
-
+
// does the footnote tooltip already exist?
var fnote = $('insitu-fn'+id);
var footnote;
if (!fnote) {
// if not create it...
-
+
// locate the footnote anchor element
- var a = $( "fn"+id );
+ var a = $( "fn"+id );
if (!a){ return; }
-
+
// anchor parent is the footnote container, get its innerHTML
footnote = new String (a.parentNode.innerHTML);
-
+
// strip the leading footnote anchors and their comma separators
footnote = footnote.replace(/<a\s.*?href=\".*\#fnt\d+\".*?<\/a>/gi, '');
footnote = footnote.replace(/^\s+(,\s+)+/,'');
-
+
// prefix ids on any elements with "insitu-" to ensure they remain unique
footnote = footnote.replace(/\bid=\"(.*?)\"/gi,'id="insitu-$1');
- } else {
+ } else {
footnote = new String(fnt.innerHTML);
}
-
+
// activate the tooltip
domTT_activate(e, evt, 'content', footnote, 'type', 'velcro', 'id', 'insitu-fn'+id, 'styleClass', 'insitu-footnote JSpopup', 'maxWidth', document.body.offsetWidth*0.4);
- currentFootnote = id;
+ currentFootnote = id;
}
@@ -332,7 +332,7 @@ function fnt(id, e, evt) {
* Add the edit window size controls
*/
function initSizeCtl(ctlid,edid){
- if(!document.getElementById){ return; }
+ if(!document.getElementById){ return; }
var ctl = $(ctlid);
var textarea = $(edid);
@@ -348,8 +348,8 @@ function initSizeCtl(ctlid,edid){
var s = document.createElement('img');
l.src = DOKU_BASE+'lib/images/larger.gif';
s.src = DOKU_BASE+'lib/images/smaller.gif';
- addEvent(l,'click',function(){sizeCtl(edid,100);});
- addEvent(s,'click',function(){sizeCtl(edid,-100);});
+ addEvent(l,'click',function(){sizeCtl(edid,100);});
+ addEvent(s,'click',function(){sizeCtl(edid,-100);});
ctl.appendChild(l);
ctl.appendChild(s);
}
@@ -378,7 +378,7 @@ function closePopups(){
var divs = document.getElementsByTagName('div');
for(var i=0; i < divs.length; i++){
if(divs[i].className.indexOf('JSpopup') != -1){
- divs[i].style.display = 'none';
+ divs[i].style.display = 'none';
}
}
}
@@ -387,6 +387,6 @@ function closePopups(){
* Looks for an element with the ID scroll__here at scrolls to it
*/
function scrollToMarker(){
- var obj = $('scroll__here');
- if(obj) obj.scrollIntoView();
+ var obj = $('scroll__here');
+ if(obj) obj.scrollIntoView();
}