| 1 |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 |
<html> <head> |
| 3 |
<title>Testing the context menu</title> |
| 4 |
|
| 5 |
</head> |
| •6 |
<script src="/javascript/mj-context-menu/ContextMenu.js"></script> |
| 7 |
<script> |
| 8 |
var dialog = new ContextMenu.Info('a', function(){ |
| 9 |
return '<b>bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb </b><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p><br>aa<p>bbb</p>';}, '<a href="http://www.mathjax.org">MathJax.org</a>'); |
| 10 |
|
| 11 |
var MENU = {}; |
| 12 |
MENU.ShowSource = function() {}; |
| 13 |
MENU.isMac = function() {}; |
| 14 |
MENU.Zoom = function() {console.log("Zooming!")}; |
| 15 |
MENU.Id = function(x) {return x}; |
| 16 |
MENU.About = function() { |
| 17 |
dialog.post(0, 0); |
| 18 |
}; |
| 19 |
|
| 20 |
var ll = {"menu": |
| 21 |
{"pool": [ |
| 22 |
{ |
| 23 |
"name": "zoom", |
| 24 |
"value": "NoZoom", |
| 25 |
"getter": MENU.Zoom, |
| 26 |
"setter": MENU.Zoom |
| 27 |
}, |
| 28 |
{ |
| 29 |
"name": "zscale", |
| 30 |
"value": "100%", |
| 31 |
"getter": MENU.Zoom, |
| 32 |
"setter": MENU.Zoom |
| 33 |
}, |
| 34 |
{ |
| 35 |
"name": "texHints", |
| 36 |
"value": false, |
| 37 |
"getter": MENU.Id, |
| 38 |
"setter": MENU.Id |
| 39 |
}, |
| 40 |
{ |
| 41 |
"name": "semantics", |
| 42 |
"value": false, |
| 43 |
"getter": MENU.Id, |
| 44 |
"setter": MENU.Id |
| 45 |
}, |
| 46 |
{ |
| 47 |
"name": "ALT", |
| 48 |
"value": false, |
| 49 |
"getter": MENU.Id, |
| 50 |
"setter": MENU.Id |
| 51 |
}, |
| 52 |
{ |
| 53 |
"name": "CMD", |
| 54 |
"value": false, |
| 55 |
"getter": MENU.Id, |
| 56 |
"setter": MENU.Id |
| 57 |
}, |
| 58 |
{ |
| 59 |
"name": "CTRL", |
| 60 |
"value": false, |
| 61 |
"getter": MENU.Id, |
| 62 |
"setter": MENU.Id |
| 63 |
}, |
| 64 |
{ |
| 65 |
"name": "Shift", |
| 66 |
"value": false, |
| 67 |
"getter": MENU.Id, |
| 68 |
"setter": MENU.Id |
| 69 |
} |
| 70 |
], |
| 71 |
"items": |
| 72 |
[ |
| 73 |
{"type": "submenu", |
| 74 |
"id": "Show", |
| 75 |
"content": "Show Math As", |
| 76 |
"menu": { |
| 77 |
"items" : [ |
| 78 |
{"type": "command", |
| 79 |
"id": "MathMLcode", |
| 80 |
"content": "MathML Code", |
| 81 |
"action": MENU.ShowSource |
| 82 |
}, |
| 83 |
{"type": "command", |
| 84 |
"id": "Original", |
| 85 |
"content": "Original Form", |
| 86 |
"action": MENU.ShowSource |
| 87 |
}, |
| 88 |
{"type": "submenu", |
| 89 |
"id": "Annotation", |
| 90 |
"content": "Annotation", |
| 91 |
"disabled": true, |
| 92 |
"menu": { |
| 93 |
"items": []} |
| 94 |
}, |
| 95 |
{"type": "rule"}, |
| 96 |
{"type": "checkbox", |
| 97 |
"id": "texHints", |
| 98 |
"content": "Show TeX hints in MathML", |
| 99 |
"variable": "texHints" |
| 100 |
}, |
| 101 |
{"type": "checkbox", |
| 102 |
"id": "semantics", |
| 103 |
"content": "Add original form as annotation", |
| 104 |
"variable": "semantics" |
| 105 |
} |
| 106 |
] |
| 107 |
} |
| 108 |
}, |
| 109 |
{"type": "rule"}, |
| 110 |
{"type": "submenu", |
| 111 |
"id": "Settings", |
| 112 |
"content": "Math Settings", |
| 113 |
"menu": |
| 114 |
{"items" : [ |
| 115 |
{"type": "submenu", |
| 116 |
"id": "ZoomTrigger", |
| 117 |
"content": "Zoom Trigger", |
| 118 |
"menu": { |
| 119 |
"items": [ |
| 120 |
{"type": "radio", |
| 121 |
"id": "Hover", |
| 122 |
"content": "Hover", |
| 123 |
"variable": "zoom" |
| 124 |
}, |
| 125 |
{"type": "radio", |
| 126 |
"id": "Click", |
| 127 |
"content": "Click", |
| 128 |
"variable": "zoom" |
| 129 |
}, |
| 130 |
{"type": "radio", |
| 131 |
"id": "DoubleClick", |
| 132 |
"content": "Double-Click", |
| 133 |
"variable": "zoom" |
| 134 |
}, |
| 135 |
{"type": "radio", |
| 136 |
"id": "NoZoom", |
| 137 |
"content": "No Zoom", |
| 138 |
"variable": "zoom", |
| 139 |
"value": "None" |
| 140 |
}, |
| 141 |
{"type": "rule"}, |
| 142 |
{"type": "label", |
| 143 |
"id": "TriggerRequires", |
| 144 |
"content": "Trigger Requires:" |
| 145 |
}, |
| 146 |
{"type": "checkbox", |
| 147 |
"id": "Option", |
| 148 |
"content": "Option", |
| 149 |
"variable": "ALT" |
| 150 |
}, |
| 151 |
{"type": "checkbox", |
| 152 |
"id": "Command", |
| 153 |
"content": "Command", |
| 154 |
"variable": "CMD", |
| 155 |
"hidden": !MENU.isMac |
| 156 |
}, |
| 157 |
{"type": "checkbox", |
| 158 |
"id": "Control", |
| 159 |
"content": "Control", |
| 160 |
"variable": "CTRL", |
| 161 |
"hidden": MENU.isMac |
| 162 |
}, |
| 163 |
{"type": "checkbox", |
| 164 |
"id": "Shift", |
| 165 |
"content": "Shift", |
| 166 |
"variable": "Shift" |
| 167 |
} |
| 168 |
] |
| 169 |
} |
| 170 |
}, |
| 171 |
{"type": "submenu", |
| 172 |
"id": "ZoomFactor", |
| 173 |
"content": "Zoom Factor", |
| 174 |
"menu": { |
| 175 |
"items": [ |
| 176 |
{"type": "radio", |
| 177 |
"content": "100%", |
| 178 |
"variable": "zscale", |
| 179 |
}, |
| 180 |
{"type": "radio", |
| 181 |
"content": "125%", |
| 182 |
"variable": "zscale", |
| 183 |
}, |
| 184 |
{"type": "radio", |
| 185 |
"content": "133%", |
| 186 |
"variable": "zscale", |
| 187 |
}, |
| 188 |
{"type": "radio", |
| 189 |
"content": "150%", |
| 190 |
"variable": "zscale", |
| 191 |
}, |
| 192 |
{"type": "radio", |
| 193 |
"content": "175%", |
| 194 |
"variable": "zscale", |
| 195 |
}, |
| 196 |
{"type": "radio", |
| 197 |
"content": "200%", |
| 198 |
"variable": "zscale", |
| 199 |
}, |
| 200 |
{"type": "radio", |
| 201 |
"content": "250%", |
| 202 |
"variable": "zscale", |
| 203 |
}, |
| 204 |
{"type": "radio", |
| 205 |
"content": "300%", |
| 206 |
"variable": "zscale", |
| 207 |
}, |
| 208 |
{"type": "radio", |
| 209 |
"content": "400%", |
| 210 |
"variable": "zscale", |
| 211 |
} |
| 212 |
] |
| 213 |
} |
| 214 |
} |
| 215 |
] |
| 216 |
} |
| 217 |
}, |
| 218 |
{"type": "rule"}, |
| 219 |
{"type": "command", |
| 220 |
"id": "About", |
| 221 |
"content": "About MathJax", |
| 222 |
"action": MENU.About, |
| 223 |
}, |
| 224 |
{"type": "command", |
| 225 |
"id": "Help", |
| 226 |
"content": "MathJax Help", |
| 227 |
"action": MENU.Help, |
| 228 |
"disabled": true |
| 229 |
} |
| 230 |
|
| 231 |
] |
| 232 |
} |
| 233 |
}; |
| 234 |
console.log(ll.menu.pool[0].action); |
| 235 |
|
| 236 |
ContextMenu.CssStyles.addInfoStyles(); |
| 237 |
ContextMenu.CssStyles.addMenuStyles(); |
| 238 |
cc = ContextMenu.Parse.contextMenu(ll); |
| 239 |
dialog.attachMenu(cc); |
| 240 |
|
| 241 |
// Unfold zoom menu: |
| 242 |
//cc.post(50,50); |
| 243 |
|
| 244 |
</script> |
| 245 |
<body> |
| 246 |
<h1 id="header">Testing the context menu</h1> |
| 247 |
<script>document.getElementById('header').innerHTML = document.getElementById('header').innerHTML + ' ' + ContextMenu.version;</script> |
| 248 |
|
| 249 |
<button onclick=cc.post(50,50)>here</button> |
| 250 |
|
| 251 |
<p><div class="test" id="t1">t1</div></p> |
| 252 |
<p><div class="test" id="t2">t2</div></p> |
| 253 |
<p><div class="test" id="t3">t3</div></p> |
| 254 |
<p><div class="test" id="t4">t4</div></p> |
| 255 |
<p><div class="test" id="t5">t5</div></p> |
| 256 |
<p><div class="test" id="t6">t6</div></p> |
| 257 |
<p><div class="test" id="t1">t1</div></p> |
| 258 |
<p><div class="test" id="t2">t2</div></p> |
| 259 |
<p><div class="test" id="t3">t3</div></p> |
| 260 |
<p><div class="test" id="t4">t4</div></p> |
| 261 |
<p><div class="test" id="t5">t5</div></p> |
| 262 |
<p><div class="test" id="t6">t6</div></p> |
| 263 |
<div class="test" id="t7">t7</div> |
| 264 |
<div class="test" id="t8">t8</div> |
| 265 |
<p><div class="test" id="t9">t9</div></p> |
| 266 |
|
| 267 |
<span class="test" id="a7" tabindex="3">a7</span> |
| 268 |
<span class="test" id="a8" tabindex="4">a8</span> |
| 269 |
|
| 270 |
<hr> |
| 271 |
<address></address> |
| 272 |
<!-- hhmts start --> |
| 273 |
Last modified: Thu May 21 17:53:12 BST 2020 |
| 274 |
<!-- hhmts end --> |
| 275 |
</body> |
| 276 |
<script>cc.store.insert(document.getElementsByClassName("test")); |
| 277 |
</script> |
| 278 |
|
| 279 |
</html> |