Skip to content

Commit 9dd2ab2

Browse files
committed
Fix #3
1 parent 77f1918 commit 9dd2ab2

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

js/base.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
// dev'ed by SGH. Ideas by LB. Uploading fee provided by BHXSpecter.
2+
function CloneItem(item) // Clone and item and its childs' callbacks.
3+
{ // Used by Code spoilers.
4+
var cloned = item.cloneNode(false); // We clone the first node.
5+
// We lose the first node's callbacks. No way to save them reliably, but we don't need them.
6+
// The childs are shared to preserve callbacks.
7+
for(var i = 0; i < item.childNodes.length; ++i)
8+
{
9+
cloned.appendChild(item.childNodes[i]);
10+
}
11+
return cloned;
12+
}
213
function ToggleDisplay( TargetDiv, DisplayIcon, ShortSize ) // Called by spoiler's <a>'s onclick handler
314
{
415
if(TargetDiv.style.height == "auto") // Already expanded?

js/enumerate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function RunPageEdit()
115115
// Cpp.sh button does not work when code spoilers are enabled.
116116
// Sorry, twicker, i'll have to hide it.
117117
// The current workaround is to disable code spoilers, no idea.
118-
if(CodeSpoilerAllowed())
118+
/*if(CodeSpoilerAllowed())
119119
{
120120
var buttonHolders = document.getElementsByClassName('C_btnholder');
121121
for(var i = 0; i != buttonHolders.length; ++i)
@@ -126,6 +126,6 @@ function RunPageEdit()
126126
buttonHolders[i].style.display = 'none';
127127
}
128128
}
129-
}
129+
}*/
130130
}
131131
}

js/transform.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function forEachItem(Item, Type, IsReplyable)
2828
newdiv.appendChild(codespan);
2929
//endcodeonly
3030

31-
newdiv.appendChild(Item.cloneNode(true));
31+
newdiv.appendChild(CloneItem(Item));
3232
Item.parentNode.replaceChild(newdiv,Item);
3333
}
3434
if(Type==1 && QuoteSpoilerAllowed())
@@ -44,7 +44,7 @@ function forEachItem(Item, Type, IsReplyable)
4444
newa.appendChild(newspan);
4545
newa.onclick = function(){ToggleDisplay(this.parentNode,newspan,ShortQuoteHeight());return false;}
4646
newdiv.appendChild(newa);
47-
newdiv.appendChild(Item.cloneNode(true));
47+
newdiv.appendChild(CloneItem(Item));
4848
Item.parentNode.replaceChild(newdiv,Item);
4949
}
5050
if(Type==2 && QuoteSpoilerAllowed())
@@ -59,7 +59,7 @@ function forEachItem(Item, Type, IsReplyable)
5959
newa.appendChild(newspan);
6060
newa.onclick = function(){ToggleDisplay(this.parentNode,newspan,ShortQuoteExtendedHeight());return false;}
6161
newdiv.appendChild(newa);
62-
newdiv.appendChild(Item.cloneNode(true));
62+
newdiv.appendChild(CloneItem(Item));
6363
Item.parentNode.replaceChild(newdiv,Item);
6464
}
6565
if(Type==3 && OutputSpoilerAllowed())
@@ -82,7 +82,7 @@ function forEachItem(Item, Type, IsReplyable)
8282
newdiv.appendChild(Outpspan);
8383
//endOutponly
8484

85-
newdiv.appendChild(Item.cloneNode(true));
85+
newdiv.appendChild(CloneItem(Item));
8686
Item.parentNode.replaceChild(newdiv,Item);
8787
}
8888
}

0 commit comments

Comments
 (0)