1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: css_util.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: css_util.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/*************************************************************
*
* Copyright (c) 2015-2016 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Utility functions for adding CSS styles.
*
* @author v.sorge@mathjax.org (Volker Sorge)
*/
/// <reference path="html_classes.ts" />
/**
* @namespace
*/
var CssStyles;
(function (CssStyles) {
/**
* Creates CSS classname by prefixing a dot.
* @param {string} name The class name.
* @return {string} The context menu class name.
*/
function makeClass_(name) {
return '.' + (ContextMenu.HtmlClasses[name] || name);
}
let INFO_STYLES = {};
INFO_STYLES[makeClass_('INFOCLOSE')] = '{' +
' top:.2em; right:.2em;' +
'}',
INFO_STYLES[makeClass_('INFOCONTENT')] = '{' +
' overflow:auto; text-align:left; font-size:80%;' +
' padding:.4em .6em; border:1px inset; margin:1em 0px;' +
' max-height:20em; max-width:30em; background-color:#EEEEEE;' +
' white-space:normal;' +
'}',
INFO_STYLES[makeClass_('INFO') + makeClass_('MOUSEPOST')] = '{' +
'outline:none;' +
'}',
INFO_STYLES[makeClass_('INFO')] = '{' +
' position:fixed; left:50%; width:auto; text-align:center;' +
' border:3px outset; padding:1em 2em; background-color:#DDDDDD;' +
' color:black;' +
' cursor:default; font-family:message-box; font-size:120%;' +
' font-style:normal; text-indent:0; text-transform:none;' +
' line-height:normal; letter-spacing:normal; word-spacing:normal;' +
' word-wrap:normal; white-space:nowrap; float:none; z-index:201;' +
' border-radius: 15px; /* Opera 10.5 and IE9 */' +
' -webkit-border-radius:15px; /* Safari and Chrome */' +
' -moz-border-radius:15px; /* Firefox */' +
' -khtml-border-radius:15px; /* Konqueror */' +
' box-shadow:0px 10px 20px #808080; /* Opera 10.5 and IE9 */' +
' -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */' +
' -moz-box-shadow:0px 10px 20px #808080; /* Forefox 3.5 */' +
' -khtml-box-shadow:0px 10px 20px #808080; /* Konqueror */' +
' filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=2,' +
' OffY=2, Color="gray", Positive="true"); /* IE */' +
'}';
let MENU_STYLES = {};
MENU_STYLES[makeClass_('MENU')] = '{' +
' position:absolute;' +
' background-color:white;' +
' color:black;' +
' width:auto; padding:5px 0px;' +
' border:1px solid #CCCCCC; margin:0; cursor:default;' +
' font: menu; text-align:left; text-indent:0; text-transform:none;' +
' line-height:normal; letter-spacing:normal; word-spacing:normal;' +
' word-wrap:normal; white-space:nowrap; float:none; z-index:201;' +
' border-radius: 5px; /* Opera 10.5 and IE9 */' +
' -webkit-border-radius: 5px; /* Safari and Chrome */' +
' -moz-border-radius: 5px; /* Firefox */' +
' -khtml-border-radius: 5px; /* Konqueror */' +
' box-shadow:0px 10px 20px #808080; /* Opera 10.5 and IE9 */' +
' -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */' +
' -moz-box-shadow:0px 10px 20px #808080; /* Forefox 3.5 */' +
' -khtml-box-shadow:0px 10px 20px #808080; /* Konqueror */' +
'}',
MENU_STYLES[makeClass_('MENUITEM')] = '{' +
' padding: 1px 2em;' +
' background:transparent;' +
'}',
MENU_STYLES[makeClass_('MENUARROW')] = '{' +
' position:absolute; right:.5em; padding-top:.25em; color:#666666;' +
' font-family: null; font-size: .75em' +
'}',
MENU_STYLES[makeClass_('MENUACTIVE') + ' ' + makeClass_('MENUARROW')] =
'{color:white}',
MENU_STYLES[makeClass_('MENUARROW') + makeClass_('RTL')] =
'{left:.5em; right:auto}',
MENU_STYLES[makeClass_('MENUCHECK')] = '{' +
' position:absolute; left:.7em;' +
' font-family: null' +
'}',
MENU_STYLES[makeClass_('MENUCHECK') + makeClass_('RTL')] =
'{ right:.7em; left:auto }',
MENU_STYLES[makeClass_('MENURADIOCHECK')] = '{' +
' position:absolute; left: .7em;' +
'}',
MENU_STYLES[makeClass_('MENURADIOCHECK') + makeClass_('RTL')] = '{' +
' right: .7em; left:auto' +
'}',
MENU_STYLES[makeClass_('MENULABEL')] = '{' +
' padding: 1px 2em 3px 1.33em;' +
' font-style:italic' +
'}',
MENU_STYLES[makeClass_('MENURULE')] = '{' +
' border-top: 1px solid #DDDDDD;' +
' margin: 4px 3px;' +
'}',
MENU_STYLES[makeClass_('MENUDISABLED')] = '{' +
' color:GrayText' +
'}',
MENU_STYLES[makeClass_('MENUACTIVE')] = '{' +
' background-color: #606872;' +
' color: white;' +
'}',
MENU_STYLES[makeClass_('MENUDISABLED') + ':focus'] = '{' +
' background-color: #E8E8E8' +
'}',
MENU_STYLES[makeClass_('MENULABEL') + ':focus'] = '{' +
' background-color: #E8E8E8' +
'}',
MENU_STYLES[makeClass_('CONTEXTMENU') + ':focus'] = '{' +
' outline:none' +
'}',
MENU_STYLES[makeClass_('CONTEXTMENU') + ' ' +
makeClass_('MENUITEM') + ':focus'] = '{' +
' outline:none' +
'}',
MENU_STYLES[makeClass_('MENU') + ' ' + makeClass_('MENUCLOSE')] = '{' +
' top:-10px; left:-10px' +
'}';
// Style of the little cross button to close a dialog or the mobile menu.
let CLOSE_ICON_STYLES = {};
CLOSE_ICON_STYLES[makeClass_('MENUCLOSE')] = '{' +
' position:absolute;' +
' cursor:pointer;' +
' display:inline-block;' +
' border:2px solid #AAA;' +
' border-radius:18px;' +
' -webkit-border-radius: 18px; /* Safari and Chrome */' +
' -moz-border-radius: 18px; /* Firefox */' +
' -khtml-border-radius: 18px; /* Konqueror */' +
' font-family: "Courier New", Courier;' +
' font-size:24px;' +
' color:#F0F0F0' +
'}',
CLOSE_ICON_STYLES[makeClass_('MENUCLOSE') + ' span'] = '{' +
' display:block; background-color:#AAA; border:1.5px solid;' +
' border-radius:18px;' +
' -webkit-border-radius: 18px; /* Safari and Chrome */' +
' -moz-border-radius: 18px; /* Firefox */' +
' -khtml-border-radius: 18px; /* Konqueror */' +
' line-height:0;' +
' padding:8px 0 6px /* may need to be browser-specific */' +
'}',
CLOSE_ICON_STYLES[makeClass_('MENUCLOSE') + ':hover'] = '{' +
' color:white!important;' +
' border:2px solid #CCC!important' +
'}',
CLOSE_ICON_STYLES[makeClass_('MENUCLOSE') + ':hover span'] = '{' +
' background-color:#CCC!important' +
'}',
CLOSE_ICON_STYLES[makeClass_('MENUCLOSE') + ':hover:focus'] = '{' +
' outline:none' +
'}';
let INFO_ADDED = false;
let MENU_ADDED = false;
let CLOSE_ICON_ADDED = false;
/**
* Adds the CSS styles for context menus.
* @param {?HTMLDocument} opt_document The HTML document.
*/
CssStyles.addMenuStyles = addMenuStyles;
function addMenuStyles(opt_document) {
if (MENU_ADDED) {
return;
}
addStyles_(MENU_STYLES, opt_document);
MENU_ADDED = true;
addCloseIconStyles_(opt_document);
}
/**
* Adds the CSS styles for info widgets.
* @param {?HTMLDocument} opt_document The HTML document.
*/
CssStyles.addInfoStyles = addInfoStyles;
function addInfoStyles(opt_document) {
if (INFO_ADDED) {
return;
}
addStyles_(INFO_STYLES, opt_document);
INFO_ADDED = true;
addCloseIconStyles_(opt_document);
}
/**
* Adds the CSS style sheets for the close button.
* @param {?HTMLDocument} opt_document The HTML document.
*/
function addCloseIconStyles_(opt_document) {
if (CLOSE_ICON_ADDED) {
return;
}
addStyles_(CLOSE_ICON_STYLES, opt_document);
CLOSE_ICON_ADDED = true;
}
/**
* Creates style elements and adds them to the document.
* @param {Object.<string, string>} styles The style dictionary.
* @param {?HTMLDocument} opt_document The HTML document.
*/
function addStyles_(styles, opt_document) {
let doc = opt_document || document;
let element = doc.createElement('style');
element.type = 'text/css';
let inner = '';
for (let style in styles) {
inner += style;
inner += ' ';
inner += styles[style];
inner += '\n';
}
element.innerHTML = inner;
doc.head.appendChild(element);
}
})(CssStyles = ContextMenu.CssStyles || (ContextMenu.CssStyles = {}));</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AbstractEntry.html">AbstractEntry</a></li><li><a href="AbstractItem.html">AbstractItem</a></li><li><a href="AbstractMenu.html">AbstractMenu</a></li><li><a href="AbstractNavigatable.html">AbstractNavigatable</a></li><li><a href="AbstractPostable.html">AbstractPostable</a></li><li><a href="Checkbox.html">Checkbox</a></li><li><a href="CloseButton.html">CloseButton</a></li><li><a href="Command.html">Command</a></li><li><a href="ContextMenu.html">ContextMenu</a></li><li><a href="Info.html">Info</a></li><li><a href="Label.html">Label</a></li><li><a href="MenuElement.html">MenuElement</a></li><li><a href="MenuStore.html">MenuStore</a></li><li><a href="Popup.html">Popup</a></li><li><a href="Radio.html">Radio</a></li><li><a href="Rule.html">Rule</a></li><li><a href="SubMenu.html">SubMenu</a></li><li><a href="Submenu_.html">Submenu</a></li><li><a href="Variable.html">Variable</a></li><li><a href="VariablePool.html">VariablePool</a></li></ul><h3>Namespaces</h3><ul><li><a href="CssStyles.html">CssStyles</a></li><li><a href="MenuUtil.html">MenuUtil</a></li></ul><h3>Interfaces</h3><ul><li><a href="Element.html">Element</a></li><li><a href="Entry.html">Entry</a></li><li><a href="Item.html">Item</a></li><li><a href="KeyNavigatable.html">KeyNavigatable</a></li><li><a href="Menu.html">Menu</a></li><li><a href="MouseNavigatable.html">MouseNavigatable</a></li><li><a href="Postable.html">Postable</a></li><li><a href="TouchNavigatable.html">TouchNavigatable</a></li><li><a href="VariableItem.html">VariableItem</a></li></ul><h3>Global</h3><ul><li><a href="global.html#HtmlAttrs">HtmlAttrs</a></li><li><a href="global.html#HtmlClasses">HtmlClasses</a></li><li><a href="global.html#KEY">KEY</a></li><li><a href="global.html#MOUSE">MOUSE</a></li><li><a href="global.html#TOUCH">TOUCH</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Aug 17 2016 12:38:38 GMT+0100 (BST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
|