1
+ // dev'ed by SGH. Ideas by LB. Uploading fee provided by BHXSpecter.
2
+ function ToggleDisplay ( TargetDiv , DisplayIcon , ShortSize ) // Called by spoiler's <a>'s onclick handler
3
+ {
4
+ if ( TargetDiv . style . height == "auto" ) // Already expanded?
5
+ {
6
+ // Close
<
10000
tr class="diff-line-row">
7
+ TargetDiv . className = "ofhide" ; //overflow:hidden
8
+ TargetDiv . style . height = ShortSize ;
9
+ DisplayIcon . className = "C_ico hiddenicon" ;
10
+ }
11
+ else
12
+ {
13
+ // Open
14
+ TargetDiv . className = "ofshow" ; //overflow:display (required for cpp.sh icon)
15
+ TargetDiv . style . height = "auto" ;
16
+ DisplayIcon . className = "C_ico shownicon" ;
17
+ }
18
+ }
19
+ function RunJavascriptCode ( Script ) // Add a <script> element with "Script" as internal js code. Do not use exec.
20
+ { // Some code does not work in any other way due to security limitations.
21
+ var ScriptElement = document . createElement ( 'script' ) ;
22
+ ScriptElement . textContent = Script ;
23
+ document . documentElement . appendChild ( ScriptElement ) ;
24
+ }
25
+ /*
26
+ * Inputs:
27
+ * Table, array-like, 0-indexed.
28
+ * Each item must have:
29
+ * Property Optional?
30
+ * name No
31
+ * value Yes
32
+ * id Yes
33
+ * FormInfo:
34
+ * Table item.
35
+ * It must have:
36
+ * Property
37
+ * id
38
+ * path
39
+ * target
40
+ * name
41
+ */
42
+ function AddHiddenForm ( Inputs , FormInfo )
43
+ {
44
+ var TargetForm = document . createElement ( 'form' ) ;
45
+ TargetForm . id = FormInfo . id ;
46
+ TargetForm . action = FormInfo . path ;
47
+ TargetForm . target = FormInfo . target ;
48
+ TargetForm . name = FormInfo . name ;
49
+ TargetForm . method = 'post' ;
50
+ var currItem ;
51
+ for ( var i = 0 ; currItem = Inputs [ i ] ; ++ i )
52
+ {
53
+ var FormInput = document . createElement ( 'input' ) ;
54
+ FormInput . type = 'hidden' ;
55
+ FormInput . name = currItem . name ;
56
+ if ( currItem . value )
57
+ FormInput . value = currItem . value ; // not required
58
+ if ( currItem . id )
59
+ FormInput . id = currItem . id ; // not required
60
+ TargetForm . appendChild ( FormInput ) ;
61
+ }
62
+ document . documentElement . appendChild ( TargetForm ) ;
63
+ }
0 commit comments