diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 8101baf5..12f4f81a 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,4 +1,24 @@ +**1.3** + +* New Options page similar to Chrome settings +* Modified the 'Toggle Styling' option in context menu +* Some UI Layout fixes for Stylebot Panel +* Added Option button to Panel +* Fixed issue where selectors of the type 'ul li' and 'ul > li' were not working +* Prettier CSS editor in options page with syntax highlighting +* Syntax errors are shown when editing / importing CSS in the Options page +* Global Stylesheet +* Updated to jQuery 1.6.1 + +**1.2.1** + +* Added support for comments +* Fixed issue where CSS selectors containing ^= weren't working properly +* Updated JSCSSP parser to support some @-webkit- properties +* Added option to hide css icon in Omnibar + **1.2** + * Added support for comments * Updated CSS Parser * Fixed issue where CSS selectors containing ^= weren't working properly @@ -6,21 +26,25 @@ * Bugfixes **1.1** + * Added option to preview changes live when picking color using Color Picker * Use up / down arrows keys to increment / decrement values * Green 'css' icon indicates style is running on a page * Preview changes live when editing entire page's CSS **1.0** + * Ability to share, browse and install styles from Stylebot Social * Cleaner options page with vertical tabs * Added option to temporarily disable custom styling of page in right click context menu * Better Sync **0.2.4** + * Added context menu **0.2.3** + * Added workaround for Chrome bug related to :last-child which caused weird issues while pasting text into certain textareas **0.2.1** diff --git a/README.markdown b/README.markdown index f5907e53..c70ffa01 100644 --- a/README.markdown +++ b/README.markdown @@ -40,6 +40,8 @@ I am using code from the following projects: * [jQuery](http://jquery.com/) +* [CodeMirror](http://codemirror.net/) + ###License Dual licensed under the GPL and MIT Licenses. \ No newline at end of file diff --git a/artwork/PSD and AI/gear-hover.psd b/artwork/PSD and AI/gear-hover.psd new file mode 100644 index 00000000..3bda26e9 Binary files /dev/null and b/artwork/PSD and AI/gear-hover.psd differ diff --git a/artwork/PSD and AI/gear.psd b/artwork/PSD and AI/gear.psd new file mode 100644 index 00000000..5eae4f5a Binary files /dev/null and b/artwork/PSD and AI/gear.psd differ diff --git a/artwork/gear-hover.png b/artwork/gear-hover.png new file mode 100644 index 00000000..45ae2c91 Binary files /dev/null and b/artwork/gear-hover.png differ diff --git a/artwork/gear.png b/artwork/gear.png new file mode 100644 index 00000000..b5b55d5f Binary files /dev/null and b/artwork/gear.png differ diff --git a/stylebot/css/controls.css b/stylebot/css/controls.css index f274ce3a..44b2431b 100644 --- a/stylebot/css/controls.css +++ b/stylebot/css/controls.css @@ -4,7 +4,7 @@ select.stylebot-select { font-size: 11px !important; font-family: 'Lucida Grande', Tahoma, Arial, sans-serif !important; -khtml-appearance: none !important; - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAhtJREFUeNqclM1LlFEUxn/3zms5WiJGEEqQlUQSlAPRNmjXIpJo178Q/TPt2rdp0VLoi0JKSXQIF0rQKhA1ZHK+nPe953lvi3fUmYYWduEsLhye+zvPOee65wsrOxcmxkbzPHLS45yjnWbLu7XGs2RkdGRs5trMsAX9l1CU7q2ub7xI2qlp63eKzAYSvfeUSiWCBfgH8NCpIQxf8XmeE+NfkQvnoNVsslat4h1AJEYN5EoiSJbIDDMhUw+JI0osvHnL8tcVpMdU5m6RpoPUEUduRmJmmNlxaQ7IHR8+LvLu0yK5cl6+es3Q6WFmLk+jXH1lRsDMSIKJEAypEHLe02k1KVuT+bt38N4TsoyDvW06U5PgHMRjpTxCMB0SCUndF0S5XObR/ENK3hEB7xyNg4ytWovYhT4iiq4gkoxgx0QQMTm+7+zjnO/CO/JcROno3ksk9Xp0WJpztFstPi8t0UkzkqREmmZcnJqkUqkMmh0Lj3wIBdFhZMEYHzvDzelJNjc3Wat+o7a7ze3r08SuH735wYwQjMTU7xFArWlcnb3Bg3qD919WeTJ/n9LZc9SbB/gBIofJSCRh6vWowP2512SuMsfslUv4sfPs1hqUPOQDcwSSCrNN/USFmNjaF+OjE+zUGngPpkGViEdSkkixFPHEvqYWjVEe+VVvF5P+j6XNsoy0k1aTZn2//mNjXTGe/BvBgYWw2mm3nv4ZACQvjFpRIwZOAAAAAElFTkSuQmCC) center right no-repeat, + background: url(data:image/png;base64,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) center right no-repeat, -webkit-gradient(linear, left top, left bottom, from(#f3f3f3), to(#bdbdbd)) !important; min-height: 18px !important; max-width: 150px !important; @@ -54,8 +54,8 @@ div.stylebot-colorselector:focus { /* Textfields & Textareas */ -input[type="text"].stylebot-textfield, -textarea.stylebot-textarea +input[type="text"].stylebot-textfield, +textarea.stylebot-textarea { background: #fff !important; border: 1px solid #C2C2C2 !important; @@ -68,13 +68,13 @@ textarea.stylebot-textarea -webkit-box-shadow: none !important; } -input.stylebot-textfield:disabled, -textarea.stylebot-textarea:disabled +input.stylebot-textfield:disabled, +textarea.stylebot-textarea:disabled { opacity: 0.5 !important; } -input[type="text"].stylebot-textfield +input[type="text"].stylebot-textfield { font-family: 'Lucida Grande', Tahoma, Arial, sans-serif !important; height: 12px !important; @@ -105,17 +105,18 @@ button.stylebot-button:disabled { } button.stylebot-button:focus:not(:disabled) { - outline: 1px solid #777 !important; } -button.stylebot-button:hover:not(:disabled) { +button.stylebot-button:hover:not(:disabled) +{ color: #313131 !important; border-color: #9d9d9d !important; -webkit-box-shadow: 0px 0px 8px rgba(212,212,212,1) !important; cursor: pointer !important; } -button.stylebot-button:active:not(:disabled) { +button.stylebot-button:active:not(:disabled) +{ background: -webkit-gradient(linear, left top, left bottom, from(#bababa), to(#f5f5f5)) !important; color: #4f4f4f !important; border-color: #b6b6b6 !important; @@ -124,14 +125,16 @@ button.stylebot-button:active:not(:disabled) { button.stylebot-active-button, button.stylebot-blue-button, button.stylebot-active-button:hover:not(:disabled), -button.stylebot-blue-button:hover:not(:disabled) { +button.stylebot-blue-button:hover:not(:disabled) +{ background: -webkit-gradient(linear, left top, left bottom, from(#b9e0f5), to(#73a4c4)) !important; color: #1c4257 !important; border-color: #7096ab !important; } button.stylebot-blue-button:active:not(:disabled), -button.stylebot-active-button:active:not(:disabled) { +button.stylebot-active-button:active:not(:disabled) +{ background: -webkit-gradient(linear, left top, left bottom, from(#81afc8), to(#b7def4)) !important; } @@ -144,14 +147,18 @@ button.stylebot-active-button:active:not(:disabled) { border-right-width: 0px !important; } -.stylebot-segmented-control button:hover:not(:disabled), -.stylebot-segmented-control button:focus:not(:disabled) { +.stylebot-segmented-control button:hover:not(:disabled), +.stylebot-segmented-control button:focus:not(:disabled) +{ -webkit-box-shadow: none !important; outline: none !important; color: #313131 !important; border-color: #b6b6b6 !important; } +.stylebot-segmented-control button:focus:not(:disabled) { +} + .stylebot-segmented-control button.stylebot-active-button { border-right-width: 1px !important; } @@ -161,7 +168,8 @@ button.stylebot-active-button:active:not(:disabled) { } .stylebot-segmented-control button.stylebot-active-button:hover:not(:disabled), -.stylebot-segmented-control button.stylebot-active-button:focus:not(:disabled) { +.stylebot-segmented-control button.stylebot-active-button:focus:not(:disabled) +{ color: #102632 !important; border-color: #7096ab !important; } diff --git a/stylebot/css/options.css b/stylebot/css/options.css index 4e6c513f..00b35dfc 100644 --- a/stylebot/css/options.css +++ b/stylebot/css/options.css @@ -1,4 +1,4 @@ -/** Stylebot options page css **/ +/** Stylebot Options Page **/ body { font-size: 14px; @@ -20,9 +20,14 @@ h1, h2, h3 { font-size: 22px; margin: 0; padding: 0; + margin-bottom: 25px; color: #555; } +h2 { + margin-bottom: 10px; +} + #tabmenu h1 { margin: 20px 10 17 5; } @@ -35,8 +40,8 @@ h1, h2, h3 { .option-section h3 { font-size: 14px; font-weight: bold; - margin: 5px 0 0 0; width: 180px; + vertical-align: middle; } a { @@ -49,25 +54,6 @@ a:hover { color: #294266; } -.description { - color: #444; - font-size: 12px !important; - line-height: 22px; - padding-top: 4px; - max-width: 400px; - text-align: justify; -} - -#footer { - font-size: 12px; - text-align: right; - line-height: 25px; - padding-right: 10px; - color: #555; -} - -/** options **/ - ul { margin: 0; padding: 0; @@ -75,7 +61,7 @@ ul { li.option { list-style-type: none; - line-height: 40px; + margin: 5px 0px; } li.option:first-of-type { @@ -83,11 +69,12 @@ li.option:first-of-type { } .option-field { - min-width: 250px; + min-width: 280px; display: inline-block; } + .option-section { - width: 600px; + width: 630px; padding-right: 20px; display: -webkit-box; -webkit-box-orient: horizontal; @@ -101,28 +88,55 @@ li.option:first-of-type { -webkit-box-flex: 1; } - .alert { position: relative; - left: -5px; + left: -2px; top: 5px; - color: red; + color: #D77582; font-size: 70%; } -/** end of options **/ +.important { + color: #D77582; + font-weight: bold; +} -/* custom styles */ +.note { + color: #555; + font-weight: bold; +} + +.description { + margin: 10px 0; + line-height: 18px; + font-size: 11px; + text-align: justify; +} + +.error { + color: hsl(349, 165%, 35%); + font-weight: bold; +} + +#footer { + font-size: 12px; + text-align: right; + line-height: 25px; + padding-right: 10px; + color: #555; +} #custom-styles { min-width: 422px; margin-bottom: 20px; } -#custom-style-install-text { - float: left; - clear: both; - margin-bottom: 30px; +#custom-styles input { + text-align: left; +} + +#custom-styles-header { + overflow: auto; } .custom-style { @@ -133,29 +147,27 @@ li.option:first-of-type { .custom-style-url { padding: 2px; + padding-left: 4px; + margin-right: 3px; width: 200px; word-wrap: break-word; display: inline-block; line-height: 20px; + border: 1px solid transparent; + outline: none; } .custom-style-url:hover { background-color: #fbfbfb; - outline: 1px solid #ccc; - padding-left: 4px; - width: 195px; - margin-right: 3px; + border: 1px solid #ccc; cursor: text; } -.custom-style-url:focus { - outline: 1px solid #aaa; -} - -#custom-styles-container input { - text-align: left; - margin-right: 4px; - margin-bottom: -1px; +#stylebot-editing-field { + width: 208px !important; + padding-left: 3px !important; + font-size: 13px !important; + margin-right: 3px !important; } #custom-styles-container .button-container { @@ -164,66 +176,82 @@ li.option:first-of-type { padding-top: 7px; } - #style-search-field { - -webkit-appearance: textfield; width: 166px; - outline: none; vertical-align: baseline; - font-size: 13px; - line-height: 15px; - margin-bottom: 20px; -} - -.important { - color: red; - font-weight: bold; + font-size: 14px; } #sync-button { width: 120px; } +/** MODAL POPUP **/ -/** end of options **/ - - -/** popup **/ -textarea.stylebot-css-code { - color: #333 ; - font-size: 12px ; - font-family: Menlo, Monaco, 'Lucida Console', monospace; - line-height: 16px; - padding: 2px; - display: block; - width: 100%; - -webkit-border-radius: 2px; +#stylebot-modal { + -webkit-border-radius: 2px !important; + position: fixed !important; } -#stylebot-modal div { +#stylebot-modal .popup-content { font-family: 'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode', Helvetica, Arial, sans-serif; - font-size: 14px; -} - -#stylebot-modal .description { - color: #666; + font-size: 12px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + margin-left: 4px; } #stylebot-modal input { text-align: left; } -#stylebot-modal button { +#stylebot-modal-buttons { float: right; + margin-right: 4px; +} + +#stylebot-modal button { + float: left; margin: 0px; margin-left: 4px; } #stylebot-modal textarea { - width: 100% !important; + color: #333 !important; + font-size: 12px !important; + font-family: Menlo, Monaco, 'Lucida Console', monospace !important; + line-height: 16px !important; + padding: 0px !important; + display: block; + width: 99% !important; + margin: 5px 2px !important; + height: 88% !important; + position: relative; + -webkit-border-radius: 2px !important; } -/** tabs **/ +#import-css textarea { + height: 84% !important; +} + +#stylebot-modal .description { + font-size: 11px !important; + margin: 0px !important; + padding: 0px !important; + color: #555 !important; +} + +#parserError { + float: left; + margin-left: 5px; + font-size: 12px !important; +} + +/** end of modal popup **/ + +/** TABS **/ + .separator { width: 96%; height: 1px; @@ -273,7 +301,7 @@ ul.menu li.tabActive a { margin: 0 0 20px 235px; float: left; max-width: 888px; - min-width: 600px; + min-width: 630px; background-color: #fff; padding: 20px; } @@ -292,8 +320,7 @@ ul.menu li.tabActive a { /** CONTROLS: CSS from Chromium Project **/ -input[type=text], -#style-search-field +input[type=text] { border: 1px solid #ccc; border-radius: 2px; @@ -409,5 +436,103 @@ input[type=radio] { /* custom inputs */ input[name=shortcutKeyCharacter] { - text-transform: uppercase; text-align: center; width: 2em; -} \ No newline at end of file + text-transform: uppercase; + text-align: center; + width: 2em; +} + +/* CodeMirror */ +.CodeMirror { + overflow-y: auto !important; + font-size: 12px !important; + line-height: 16px !important; + font-family: Menlo, Monaco, 'Lucida Console', monospace !important; + position: relative !important; + margin: 5px 0px !important; + border: 1px solid #ccc !important; + padding: 0px !important; + background-color: #fbfbfb !important; + resize: none !important; + outline: none !important; + width: 99% !important; + height: 87% !important; +} + +/** slightly variable CodeMirror heights based on type of modal popup **/ +#add-css .CodeMirror { + height: 84% !important; +} + +#edit-css .CodeMirror { + height: 86% !important; +} + +.CodeMirror-error { + background-color: #D77582 !important; + color: white !important; +} + +.CodeMirror-gutter { + position: absolute; + left: 0; + top: 0; + background-color: #f7f7f7; + border-right: 1px solid #eee; + min-width: 2em; + height: 100% !important; +} + +.CodeMirror-gutter-text { + color: #aaa; + text-align: right; + padding: .4em .2em .4em .4em; + height: 100% !important; +} + +.CodeMirror-lines { + padding: .4em; +} + +.CodeMirror pre { + -moz-border-radius: 0; + -webkit-border-radius: 0; + -o-border-radius: 0; + border-radius: 0; + border-width: 0; + margin: 0; + padding: 0; + background: transparent; + font-family: Menlo, Monaco, 'Lucida Console', monospace; +} + +.CodeMirror-cursor { + z-index: 10; + position: absolute; + visibility: hidden; + border-left: 1px solid black !important; +} + +.CodeMirror-focused .CodeMirror-cursor { + visibility: visible; +} + +span.CodeMirror-selected { + background: #ccc !important; + color: HighlightText !important; +} +.CodeMirror-focused span.CodeMirror-selected { + background: Highlight !important; +} + +.CodeMirror-matchingbracket {color: #0f0 !important;} +.CodeMirror-nonmatchingbracket {color: #f22 !important;} + +span.css-at {color: #708;} +span.css-unit {color: #281;} +span.css-value {color: #708;} +span.css-identifier {color: black;} +span.css-selector {color: #11B;} +span.css-important {color: #00F;} +span.css-colorcode {color: #299;} +span.css-comment {color: #A70;} +span.css-string {color: #A22;} diff --git a/stylebot/css/widget.css b/stylebot/css/widget.css index 56ec401d..f9680c89 100644 --- a/stylebot/css/widget.css +++ b/stylebot/css/widget.css @@ -34,10 +34,24 @@ line-height: 14px !important; overflow: auto !important; padding: 8px !important; + padding-right: 0px !important; text-shadow: 0px 1px 1px #fff !important; width: auto !important; } +#stylebot-header .stylebot-editable-text { + font-family: 'Lucida Grande', Arial, sans-serif !important; + margin: 0 !important; + padding: 0 !important; + width: 178px !important; + float: left !important; +} + +#stylebot-header .stylebot-editable-text:hover { + background-color: #fbfbfb !important; + cursor: text !important; +} + #stylebot-header input { clear: both !important; float: left !important; @@ -47,14 +61,7 @@ #stylebot-header-container { display: inline-block; float: left !important; - width: 73% !important; -} - -#stylebot-header-url { - clear: both !important; - display: block !important; - float: left !important; - margin-top: 10px !important; + width: 202px !important; } #stylebot-header-selector { @@ -62,43 +69,65 @@ border-radius: 2px !important; display: inline-block !important; float: left !important; - max-width: 100% !important; overflow: hidden !important; - width: auto !important; padding: 0 !important; margin: 0 !important; } -#stylebot-header .stylebot-editable-text { - font-size: 11px !important; - font-family: 'Lucida Grande', Arial, sans-serif !important; - margin: 0 !important; - padding: 0 !important; - width: auto !important; +#stylebot-header-selector .stylebot-editable-text { + font-size: 12px !important; + float: left !important; + padding: 1px 0 0 3px !important; + height: 16px !important; + width: 178px !important; } -#stylebot-header .stylebot-editable-text:hover { - background-color: #fbfbfb !important; - cursor: text !important; +#stylebot-header-selector #stylebot-editing-field { + width: 179px !important; + border: none !important; + border-radius: 0 !important; + font-size: 12px !important; + height: 16px !important; + padding: 1px 0 0 2px !important; } -#stylebot-header-selector .stylebot-editable-text{ - font-size: 12px !important; +#stylebot-header-url { + clear: both !important; + display: block !important; float: left !important; + font-size: 11px !important; + margin-top: 8px !important; +} + +#stylebot-header-url .stylebot-editable-text { padding-left: 3px !important; + border-radius: 2px !important; + width: 197px !important; + border: 1px solid transparent !important; +} + +#stylebot-header-url .stylebot-editable-text:hover { + border-color: #c2c2c2 !important; +} + +#stylebot-header-url #stylebot-editing-field { + width: 199px !important; + border: none !important; + padding: 2px 0 2px 3px !important; } #stylebot-dropdown { background-color: #fbfbfb !important; border: 1px solid #ccc !important; + border-top: none !important; border-radius: 2px !important; display: block; width: auto !important; - min-width: 40px; - max-width: 150px; + width: 195px; position: fixed !important; z-index: 10000000 !important; overflow: auto !important; + margin-top: 1px !important; } #stylebot-dropdown li { @@ -111,6 +140,7 @@ padding: 2px !important; text-shadow: none !important; margin: 0px !important; + width: 195px !important; } #stylebot-dropdown li.stylebot-dropdown-li:hover, #stylebot-dropdown li.stylebot-dropdown-li-selected { @@ -156,8 +186,8 @@ .stylebot-header-button { cursor: pointer !important; - height: 15px !important; - width: 15px !important; + height: 16px !important; + width: 18px !important; padding: 0px !important; margin: 0px !important; margin-top: -1px !important; @@ -191,12 +221,22 @@ } #stylebot-dropdown-button { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKlJREFUeNpiZEACDx8+FABSBgy4wQV5efkPGKJAjQYgjEcjdjVQQQEGIgBIHcwAJpgmrM7BAmDqwPqAhAMDGQCkjwldMCMzQwCIFQiJgZ2NxdB+ID4PVGwA0wik9gPxfGI0FwLxA5AGoEYHqEYFqDh+zTOmzwAFiCPMAKhGR6D4BWJsRjZgAy6N8FCjJLQvEEpZ2FIaSB8TSqQTmcIwEhU5aZuRklwFEGAAoDZsIypmv/AAAAAASUVORK5CYII=) no-repeat !important; - margin-left: 5px !important; + background: 2px 2px url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKlJREFUeNpiZEACDx8+FABSBgy4wQV5efkPGKJAjQYgjEcjdjVQQQEGIgBIHcwAJpgmrM7BAmDqwPqAhAMDGQCkjwldMCMzQwCIFQiJgZ2NxdB+ID4PVGwA0wik9gPxfGI0FwLxA5AGoEYHqEYFqDh+zTOmzwAFiCPMAKhGR6D4BWJsRjZgAy6N8FCjJLQvEEpZ2FIaSB8TSqQTmcIwEhU5aZuRklwFEGAAoDZsIypmv/AAAAAASUVORK5CYII=) no-repeat !important; + height: 18px !important; + width: 18px !important; } #stylebot-dropdown-button:hover { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAIAAAC0tAIdAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHdJREFUeNpizMrKYiAaMDGQAgapamFhYU5OTjiXEwxwqo6NjS0oKICoAJJAdkhICE7Va9asARoPVAQhISLICphNTU3hnE+fPl27ds3JycnNzQ3InjBhwvfv33Gqhmvg4+ObNWsWmlIgYMH0+JMnT4BKh1VcAgQYAHwILDX2U9sNAAAAAElFTkSuQmCC) no-repeat !important; + background: 2px 2px url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAIAAAC0tAIdAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHdJREFUeNpizMrKYiAaMDGQAgapamFhYU5OTjiXEwxwqo6NjS0oKICoAJJAdkhICE7Va9asARoPVAQhISLICphNTU3hnE+fPl27ds3JycnNzQ3InjBhwvfv33Gqhmvg4+ObNWsWmlIgYMH0+JMnT4BKh1VcAgQYAHwILDX2U9sNAAAAAElFTkSuQmCC) no-repeat !important; + background-color: #6a6a6a !important; +} + +#stylebot-settings-button { +background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M/3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4MUFGNEQyRDBBMjA2ODExOUYxMkNCNUY0Qzc4OTU2NCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNzMxNDJGMTc4NzQxMUUwQThCOEMyMzY5NTY0MTc5RiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNzMxNDJGMDc4NzQxMUUwQThCOEMyMzY5NTY0MTc5RiIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjgzQUY0RDJEMEEyMDY4MTE5RjEyQ0I1RjRDNzg5NTY0IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjgxQUY0RDJEMEEyMDY4MTE5RjEyQ0I1RjRDNzg5NTY0Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+0LPC9gAAAUpJREFUeNpi/P//PwMIMDFAAUAAMcJEWDKzMn8D6fsAAQQWAXKKgZweIBaDqV0ExHeA+C1AAMH1wAFIICMzoxKI60FsmJZJQMyGbB8jELeBGAABhGkGGmCBMYBOKYUaMxPqApnp06Z/YUFSzA7ENUDMBcT8QPyPKCsAAoigAiYGAoAF6kCQ/R1AnADEc4GYFejAfLgJQM5PIFUAxNpAfBqIBdCD7jQQ7wSxofz/MDbMm+ZA/Bdo1VQgHQDEa1EcCbQC5GdxKHYE4jyivQkQYAQVEAIY4QQKEiBmhrKnA/ExIBaB8jnwugApPAugQseB+BMQu0P5B4E4GOjntxipBQpmALE/EB8D0UCFb5AMnwakEoF4FsgQXF6oBOI5QGwMxE5IXrEGUm5AvAeIK/CFwQdomj0KxH5A/AuoGeTHaiA+D8QgA7/RNhZIBQCfE4btSa2i1wAAAABJRU5ErkJggg==) no-repeat !important; +} + +#stylebot-settings-button:hover { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M/3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NEFGNEQyRDBBMjA2ODExOUYxMkNCNUY0Qzc4OTU2NCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNzMxNDJGNTc4NzQxMUUwQThCOEMyMzY5NTY0MTc5RiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNzMxNDJGNDc4NzQxMUUwQThCOEMyMzY5NTY0MTc5RiIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjg1QUY0RDJEMEEyMDY4MTE5RjEyQ0I1RjRDNzg5NTY0IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg0QUY0RDJEMEEyMDY4MTE5RjEyQ0I1RjRDNzg5NTY0Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8++lu6jgAAAmFJREFUeNpizMrKYgCC/0xA4h6IBRBAjEARaSD9lOHXr1//r1+//h8ggBhAIh0dHf9BIDs7G6z26ePHjxlu3rzJABRjAAggRqgpJ4H4CBAXg1T8V1RUNFNVVS0Csv+ABBju37/PwMzMDGIygwUYGRkZbty4AWJOBAggmBmrgTiEAROwg3QcAEkqKCgwKCkpgXW3tLSAaSD4CVKwFWw40A6gOxnU1dUZBAUFwU6EeQ1m3Gcg5kEyvgOIKwECCFlBCxCXAvFlII4G4psgQRaQ6SD/IOk0BuIbUI/bgtzwDSSqr6/P0NzczKCrq8tgYGAAErIBYgOQAjYQLy0tjaG+vp7h6dOnDDw8cKesAAdMfHw8w86dOxn+/fvH8O7dO4bIyEiYAkWQGxgWLlzIMHXqVLBuV1dXhvXr18MU9IF8AQr0XlDAODs7Mxw4cABsEgiDggFkQh841v//792zZw9M5y8g5gIxAAKMBSkcwG4FmYYWYMjgOxDXQw39CxJggko0giwB4pnImk1MTBiioqJg8QYCnEDcBQ3XObCABsVANUwFKDxBQQYCR48eZfjy5QvDlClTwHyQ/9asWQOL52SQV0AGhMM0W1lZMXh4eDAcOXKEYcWKFfAEsWnTJgZjY2Nw8L5//54BKSwSQF54BOMdP36cYdWqVWCnCwgIwD3OwcHBYGNjw7Bv3z6G/fv3I4fJHZALIqC5igdkIyhZgpyuo6PDEBYWxsDExMSwfft2hitXrjBwcnLCXQWNiSDk1DgH6i9iACgPBMHCAAZSoFgIGp2uQMwPTYsfgXg3EC9A9jIIAAAd18rej52KPgAAAABJRU5ErkJggg==) no-repeat !important; } /* @end */ diff --git a/stylebot/js/apply-css.js b/stylebot/js/apply-css.js index 34ddde4c..2ec42abb 100644 --- a/stylebot/js/apply-css.js +++ b/stylebot/js/apply-css.js @@ -1,5 +1,5 @@ /** - * This content script injects any custom style for the page (if it exists) + * This content script injects any custom style for the page (if it exists) * as soon as the document starts loading. **/ @@ -12,7 +12,7 @@ chrome.extension.sendRequest({ name: "getRulesForPage", url: window.location.hre stylebotTempUrl = response.url; stylebotTempRules = response.rules; var css = CSSUtils.crunchCSS(response.rules, true); - if (css != "") + if (css != "") { CSSUtils.injectCSS(css, "stylebot-css"); } diff --git a/stylebot/js/background.js b/stylebot/js/background.js index 1501c88f..1fbd0846 100644 --- a/stylebot/js/background.js +++ b/stylebot/js/background.js @@ -1,7 +1,9 @@ /* Background JS for Stylebot */ -// Major Version. Used to checked if it has to show the release notes or not. -var CURRENT_MAJOR_VERSION = "1.2"; +// Major Version. Used to check if the release notes should be shown during update +// Only updated for X.X releases +// +var CURRENT_MAJOR_VERSION = "1.3"; var currTabId; var contextMenuId = null; diff --git a/stylebot/js/chrome.js b/stylebot/js/chrome.js index 1c892204..e0ee1e02 100644 --- a/stylebot/js/chrome.js +++ b/stylebot/js/chrome.js @@ -58,6 +58,10 @@ stylebot.chrome = { pushStyles: function() { chrome.extension.sendRequest({ name: "pushStyles" }, function(){}); + }, + + openOptionsPage: function() { + window.open(chrome.extension.getURL("options.html")); } } diff --git a/stylebot/js/events.js b/stylebot/js/events.js index 9804a9d2..c354e50d 100644 --- a/stylebot/js/events.js +++ b/stylebot/js/events.js @@ -1,13 +1,13 @@ /** * Events - * + * * Events for Stylebot Panel Controls in Basic Mode **/ Events = { - + accordionTimer: null, - + onToggle: function(e) { var el = $(this); var className = 'stylebot-active-button'; @@ -23,7 +23,7 @@ Events = { } Events.saveProperty(property, value); }, - + onRadioClick: function(e) { var value; @@ -44,24 +44,24 @@ Events = { else Events.saveProperty(property, value); }, - + onTextFieldKeyUp: function(e) { if (e.keyCode == 27) { // esc e.target.blur(); return; } - + var value = e.target.value; var property = $(e.target).data('property'); - + stylebot.style.apply(property, value); }, - + onTextFieldFocus: function(e) { stylebot.style.saveState(); $(e.target).data('lastState', e.target.value); }, - + onTextFieldBlur: function(e) { if ($(e.target).data('lastState') == e.target.value) { stylebot.style.clearLastState(); @@ -73,36 +73,36 @@ Events = { onSizeFieldKeyDown: function(e) { // increment / decrement value by 1 with arrow keys - // + // if (e.keyCode === 38 || e.keyCode === 40) { // up / down arrow e.preventDefault(); - + var value = e.target.value; - var property = $(e.target).data('property'); - var unit = $(e.target).next().attr('value'); - + var property = $(e.target).data('property'); + var unit = $(e.target).next().attr('value'); + value = parseInt(value); - + if (isNaN(value)) { value = 0; } - + else { if (e.keyCode === 38) // up value += 1; else value -= 1; } - + e.target.value = value; - + if ( parseFloat(value) ) value += unit; stylebot.style.apply(property, value); } }, - + onSizeFieldKeyUp: function(e) { if (e.keyCode === 27) // esc { @@ -114,7 +114,7 @@ Events = { // we're already handling this case in onSizeFieldKeyDown return; } - + var value = e.target.value; var property = $(e.target).data('property'); var unit = $(e.target).next().attr('value'); @@ -125,11 +125,11 @@ Events = { stylebot.style.apply(property, value); // state is saved for undo in onTextFieldFocus and onTextFieldBlur }, - + onSelectChange: function(e) { var value = e.target.value.split(','); var property = $(e.target).find('[value=' + e.target.value + ']').data('property'); - + if (typeof(property) == "object") { var len = property.length; @@ -140,7 +140,7 @@ Events = { else Events.saveProperty(property, value); }, - + onSegmentedControlClick: function(e) { var el = $(e.target); if (el.get(0).tagName != 'BUTTON') @@ -162,7 +162,7 @@ Events = { Events.saveProperty(el.data('property'), ''); el.focus(); }, - + toggleAccordion: function(h) { if (h.hasClass('stylebot-accordion-active')) { @@ -176,7 +176,7 @@ Events = { .focus() .next().show(); } - + // determine which accordions are open and // send request to save the new state to background.html cache if (this.accordionTimer) @@ -184,7 +184,7 @@ Events = { this.accordionTimer = setTimeout(function() { var len = stylebot.widget.basic.cache.accordionHeaders.length; var enabledAccordions = []; - + for (var i = 0; i < len; i++) { if ($(stylebot.widget.basic.cache.accordionHeaders[i]).hasClass( 'stylebot-accordion-active' )) @@ -195,7 +195,7 @@ Events = { }, 500); }, - + saveProperty: function(property, value) { // save current state to undo stack stylebot.style.saveState(); diff --git a/stylebot/js/libs/codemirror.js b/stylebot/js/libs/codemirror.js new file mode 100644 index 00000000..11b42f04 --- /dev/null +++ b/stylebot/js/libs/codemirror.js @@ -0,0 +1 @@ +var CodeMirror=function(){function D(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function B(a){return a.replace(/[<>&]/g,function(a){return a=="&"?"&":a=="<"?"<":">"})}function A(a){return{line:a.line,ch:a.ch}}function z(a,b){return a.linea&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function g(a,b){this.styles=b||[a,null],this.stateAfter=null,this.text=a,this.marked=this.gutterMarker=this.className=null}function f(a){this.pos=this.start=0,this.string=a}function e(a,b,c){return a.startState?a.startState(b,c):!0}function d(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function a(b,c){function cH(a,b,c){this.atOccurrence=!1,c==null&&(c=typeof a=="string"&&a==a.toLowerCase()),b&&typeof b=="object"?b=bY(b):b={line:0,ch:0},this.pos={from:b,to:b};if(typeof a!="string")this.matches=function(b,c){if(b){var d=T[c.line].text.slice(0,c.ch),e=d.match(a),f=0;while(e){var g=d.indexOf(e[0]);f+=g,d=d.slice(g+1);var h=d.match(a);if(h)e=h;else break}}else var d=T[c.line].text.slice(c.ch),e=d.match(a),f=e&&c.ch+d.indexOf(e[0]);if(e)return{from:{line:c.line,ch:f},to:{line:c.line,ch:f+e[0].length},match:e}};else{c&&(a=a.toLowerCase());var d=c?function(a){return a.toLowerCase()}:function(a){return a},e=a.split("\n");e.length==1?this.matches=function(b,c){var e=d(T[c.line].text),f=a.length,g;if(b?c.ch>=f&&(g=e.lastIndexOf(a,c.ch-f))!=-1:(g=e.indexOf(a,c.ch))!=-1)return{from:{line:c.line,ch:g},to:{line:c.line,ch:g+f}}}:this.matches=function(a,b){var c=b.line,f=a?e.length-1:0,g=e[f],h=d(T[c].text),i=a?h.indexOf(g)+g.length:h.lastIndexOf(g);if(!(a?i>=b.ch||i!=g.length:i<=b.ch||i!=h.length-g.length))for(;;){if(a?!c:c==T.length-1)return;h=d(T[c+=a?-1:1].text),g=e[a?--f:++f];if(f>0&&f=T.length)continue;var c=cz(b),g=c&&T[c-1].stateAfter;g?g=d(S,g):g=e(S);for(var h=c,i=T.length;ha){U.push(h),cC(f.workDelay),ba.push({from:b,to:h});return}var l=j.highlight(S,g);j.stateAfter=d(S,g);if(k&&!l&&j.text)break}ba.push({from:b,to:h})}}function cA(a){var b=cz(a),c=b&&T[b-1].stateAfter;c?c=d(S,c):c=e(S);for(var f=b;fe;--d){if(d==0)return 0;var f=T[d-1];if(f.stateAfter)return d;var g=f.indentation();if(c==null||b>g)c=d,b=g}return c}function cy(a){function p(a,b,c){if(!!a.text){var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}}var b=X.inverted?X.from:X.to,c=T[b.line],d=b.ch-1,e=d>=0&&cx[c.text.charAt(d)]||cx[c.text.charAt(++d)];if(!!e){var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;ku.clientWidth||e-c.top>u.clientHeight))return null;var f=w(M),g=be+Math.floor((e-f.top)/cr());return bY({line:g,ch:co(bX(g),d-f.left)})}function ct(){return M.offsetLeft}function cs(){return M.offsetTop}function cr(){var a=O.childNodes.length;if(a)return O.offsetHeight/a;B.innerHTML="
x
";return B.firstChild.offsetHeight||1}function cq(a){var b=cp(a,!0),c=w(M);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function cp(a,b){var c=cr(),d=a.line-(b?be:0);return{x:cn(a.line,a.ch),y:d*c,yBot:(d+1)*c}}function co(a,b){function e(a){B.innerHTML="
"+c.getHTML(null,null,!1,a)+"
";return B.firstChild.firstChild.offsetWidth}if(b<=0)return 0;var c=T[a],d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/cm("x")));for(;;){var k=e(j);if(k<=b&&ji)return h;j=Math.floor(h*.8),k=e(j),kb-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function cn(a,b){if(b==0)return 0;B.innerHTML="
"+T[a].getHTML(null,null,!1,b)+"
";return B.firstChild.firstChild.offsetWidth}function cm(a){B.innerHTML="
x
",B.firstChild.firstChild.firstChild.nodeValue=a;return B.firstChild.firstChild.offsetWidth||10}function cl(a){if(typeof a=="number"){var b=a;a=T[a];if(!a)return null}else{var b=D(T,a);if(b==-1)return null}var c=a.gutterMarker;return{line:b,text:a.text,markerText:c&&c.text,markerClass:c&&c.style}}function ck(a,b){if(typeof a=="number"){var c=a;a=T[bX(a)]}else{var c=D(T,a);if(c==-1)return null}a.className=b,ba.push({from:c,to:c+1});return a}function cj(a){typeof a=="number"&&(a=T[bX(a)]),a.gutterMarker=null,bS()}function ci(a,b,c){typeof a=="number"&&(a=T[bX(a)]),a.gutterMarker={text:b,style:c},bS();return a}function ch(a,b,c){function e(a,b,c,e){var a=T[a],f=a.addMark(b,c,e);f.line=a,d.push(f)}a=bY(a),b=bY(b);var d=[];if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f-1&&(a==null&&(a=f),b=f)}a!=null&&ba.push({from:a,to:b+1})}}function cg(){var a=f.gutter||f.lineNumbers;I.style.display=a?"":"none",a?bS():O.parentNode.style.marginLeft=0}function cf(){S=a.getMode(f,f.mode);for(var b=0,c=T.length;b0&&/\w/.test(b.charAt(c-1)))--c;while(d=T.length)return{line:T.length-1,ch:T[T.length-1].text.length};var b=a.ch,c=T[a.line].text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function bX(a){return Math.max(0,Math.min(a,T.length-1))}function bW(a,b,c){var d=bY({line:a,ch:b||0});(c?bU:bV)(d,d)}function bV(a,b,c,d){if(!y(X.from,a)||!y(X.to,b)){if(z(b,a)){var e=b;b=a,a=e}var f=y(X.to,b),g=y(X.from,a);y(a,b)?X.inverted=!1:f&&!g?X.inverted=!0:g&&!f&&(X.inverted=!1),c==null&&(c=X.from.line,d=X.to.line),y(a,b)?y(X.from,X.to)||ba.push({from:c,to:d+1}):y(X.from,X.to)?ba.push({from:a.line,to:b.line+1}):(y(a,X.from)||(a.line':"
",g,"
")}I.style.display="none",J.innerHTML=c.join("");var h=String(T.length).length,i=J.firstChild,j=x(i),k="";while(j.length+k.length0;--k)O.removeChild(j?j.previousSibling:O.lastChild);else if(i){for(var k=Math.max(0,i);k>0;--k)O.insertBefore(l.createElement("pre"),j);for(var k=Math.max(0,-i);k>0;--k)O.removeChild(j?j.previousSibling:O.lastChild)}var m=O.childNodes[h.domStart+d],n=b=h.from;for(var k=h.from;kj.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to=m)break;if(j.domStart>o||j.from>q)n.push({from:q,to:j.from,domSize:j.domStart-o,domStart:o}),r+=j.from-q;q=j.to,o=j.domStart+(j.to-j.from)}if(o!=p||q!=m)r+=Math.abs(m-q),n.push({from:q,to:m,domSize:p-o,domStart:o});if(!n.length)return;O.style.display="none",r>(k.to-k.from)*.3?bQ(l=Math.max(k.from-10,0),m=Math.min(k.to+7,T.length)):bR(n),O.style.display="";var s=l!=be||m!=bf||bg!=u.clientHeight;be=l,bf=m,H.style.top=l*cr()+"px",s&&(bg=u.clientHeight,v.style.height=T.length*cr()+2*cs()+"px",bS());var t=cm(bk);M.style.width=t>u.clientWidth?t+"px":"";if(O.childNodes.length!=bf-be)throw new Error("BAD PATCH! "+JSON.stringify(n)+" size="+(bf-be)+" nodes="+O.childNodes.length);bT()}}function bO(){var a=cr(),b=u.scrollTop-cs();return{from:Math.min(T.length,Math.max(0,Math.floor(b/a))),to:Math.min(T.length,Math.ceil((b+u.clientHeight)/a))}}function bN(a,b,c,d){var e=ct(),g=cs(),h=cr();b+=g,d+=g,a+=e,c+=e;var i=u.clientHeight,j=u.scrollTop,k=!1,l=!0;bj+i&&(u.scrollTop=d+h-i,k=!0);var m=u.clientWidth,n=u.scrollLeft;am+n&&(u.scrollLeft=c+10-m,k=!0,c>v.clientWidth&&(l=!1)),k&&f.onScroll&&f.onScroll(bm);return l}function bM(){var a=cp(X.inverted?X.from:X.to);return bN(a.x,a.y,a.x,a.yBot)}function bL(){var a=[],b=Math.max(0,X.from.line-1),c=Math.min(T.length,X.to.line+2);for(var d=b;d=a)return{line:c,ch:a-d};++c,d=e+1}}var a=!1,b=L.value,c=F(L);if(!c)return!1;var a=bi.text!=b,d=Z,e=a||c.start!=bi.start||c.end!=(d?bi.start:bi.end);if(!e&&!d)return!1;if(a){Y=Z=null;if(f.readOnly){_=!0;return"changed"}}var h=g(c.start,bi.from),i=g(c.end,bi.from);if(d){h=c.start==d.anchor?i:h,i=Y?X.to:c.start==d.anchor?h:i;if(!z(h,i)){Z=null,X.inverted=!1;var j=h;h=i,i=j}}h.line==i.line&&h.line==X.from.line&&h.line==X.to.line&&!Y&&(_=!1);if(a){var k=0,l=b.length,m=Math.min(l,bi.text.length),n,o=bi.from,p=-1;while(k-1?k-p:k,r=bi.to-1,s=bi.text.length;for(;;){n=bi.text.charAt(s),n=="\n"&&r--;if(b.charAt(l)!=n){++l,++s;break}if(s<=k||l<=k)break;--l,--s}var p=bi.text.lastIndexOf("\n",s-1),t=p==-1?s:s-p-1;bx({line:o,ch:q},{line:r,ch:t},E(b.slice(k,l)),h,i);if(o!=r||h.line!=o)_=!0}else bV(h,i);bi.text=b,bi.start=c.start,bi.end=c.end;return a?"changed":e?"moved":!1}function bJ(a){function c(){cD();var d=bK();d=="moved"&&a&&(t[a]=!0),!d&&!b?(b=!0,P.set(80,c)):(bH=!1,bI()),cE()}var b=!1;bH=!0,P.set(20,c)}function bI(){bH||P.set(2e3,function(){cD(),bK(),W&&bI(),cE()})}function bG(){return bF(X.from,X.to)}function bF(a,b){var c=a.line,d=b.line;if(c==d)return T[c].text.slice(a.ch,b.ch);var e=[T[c].text.slice(a.ch)];for(var f=c+1;fh&&(bk=o,h=o.length,f=!1)}if(f){h=0;for(var i=0,n=T.length;ih&&(h=o.length,bk=o)}}var p=[],q=c.length-j-1;for(var i=0,o=U.length;ib.line&&p.push(r+q)}c.length&&p.push(a.line),U=p,cC(100),ba.push({from:a.line,to:b.line+1,diff:q}),bb={from:a,to:b,text:c},bV(d,e,s(X.from.line),s(X.to.line)),v.style.height=T.length*cr()+2*cs()+"px"}function bA(){by(V.undone,V.done)}function bz(){by(V.done,V.undone)}function by(a,b){var c=a.pop();if(c){var d=[],e=c.start+c.added;for(var f=c.start;ff.undoDepth)V.done.shift()}bB(a,b,c,d,e)}function bw(){W&&f.onBlur&&f.onBlur(bm),clearInterval(R),Y=null,W=!1,u.className=u.className.replace(" CodeMirror-focused","")}function bv(){!W&&f.onFocus&&f.onFocus(bm),W=!0,bI(),u.className.search(/\bCodeMirror-focused\b/)==-1&&(u.className+=" CodeMirror-focused"),cw()}function bu(a){if(!f.onKeyEvent||!f.onKeyEvent(bm,k(a.e))){if(f.electricChars&&S.electricChars){var b=String.fromCharCode(a.e.charCode==null?a.e.keyCode:a.e.charCode);S.electricChars.indexOf(b)>-1&&setTimeout(cG(function(){ce(X.to.line,"smart")}),50)}var c=a.e.keyCode;c==13?(f.readOnly||cc(),a.stop()):!a.e.ctrlKey&&!a.e.altKey&&!a.e.metaKey&&c==9&&f.tabMode!="default"?a.stop():bJ(bh)}}function bt(a){Z&&(Z=null,_=!0),a.e.keyCode==16&&(Y=null)}function bs(a){W||bv();var b=a.e.keyCode,c=(s?a.e.metaKey:a.e.ctrlKey)&&!a.e.altKey,d=a.e.ctrlKey||a.e.altKey||a.e.metaKey;b==16||a.e.shiftKey?Y=Y||(X.inverted?X.to:X.from):Y=null;if(!f.onKeyEvent||!f.onKeyEvent(bm,k(a.e))){if(b==33||b==34){bZ(b==34);return a.stop()}if(c&&(b==36||b==35||s&&(b==38||b==40))){b$(b==36||b==38);return a.stop()}if(c&&b==65){b_();return a.stop()}if(!f.readOnly){if(!d&&b==13)return;if(!d&&b==9&&cd(a.e.shiftKey))return a.stop();if(c&&b==90){bz();return a.stop()}if(c&&(a.e.shiftKey&&b==90||b==89)){bA();return a.stop()}}bh=(c?"c":"")+b;if(X.inverted&&t.hasOwnProperty(bh)){var e=F(L);e&&(Z={anchor:e.start},G(L,e.start,e.start))}bJ(bh)}}function br(a){var b=cu(a,!0),c=a.e.dataTransfer.files;if(!!b&&!f.readOnly)if(c&&c.length&&window.FileReader&&window.File){var d=c.length,e=Array(d),g=0;for(var h=0;h=c.to||b.line=0&&a",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},cF=0;cH.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function d(a){var c={line:a,ch:0};b.pos={from:c,to:c},b.atOccurrence=!1;return!1}var b=this,c=bY(a?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(a,c)){this.atOccurrence=!0;return this.pos.match||!0}if(a){if(!c.line)return d(0);c={line:c.line-1,ch:T[c.line-1].text.length}}else{if(c.line==T.length-1)return d(T.length);c={line:c.line+1,ch:0}}}},from:function(){if(this.atOccurrence)return A(this.pos.from)},to:function(){if(this.atOccurrence)return A(this.pos.to)}};return bm}a.defaults={value:"",mode:null,indentUnit:2,indentWithTabs:!1,tabMode:"classic",enterMode:"indent",electricChars:!0,onKeyEvent:null,lineNumbers:!1,gutter:!1,firstLineNumber:1,readOnly:!1,onChange:null,onCursorActivity:null,onGutterClick:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,undoDepth:40,tabindex:null,document:window.document};var b={},c={};a.defineMode=function(c,d){!a.defaults.mode&&c!="null"&&(a.defaults.mode=c),b[c]=d},a.defineMIME=function(a,b){c[a]=b},a.getMode=function(d,e){typeof e=="string"&&c.hasOwnProperty(e)&&(e=c[e]);if(typeof e=="string")var f=e,g={};else if(e!=null)var f=e.name,g=e;var h=b[f];if(!h){window.console&&console.warn("No mode "+f+" found, falling back to plain text.");return a.getMode(d,"text/plain")}return h(d,g||{})},a.listModes=function(){var a=[];for(var c in b)b.propertyIsEnumerable(c)&&a.push(c);return a},a.listMIMEs=function(){var a=[];for(var b in c)c.propertyIsEnumerable(b)&&a.push(b);return a},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex);if(b.form){var e=m(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);h.save=d,h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))};return h},a.startState=e,a.copyState=d,f.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.posb},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1){this.pos=b;return!0}},backUp:function(a){this.pos-=a},column:function(){return v(this.string,this.start)},indentation:function(){return v(this.string)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);e&&b!==!1&&(this.pos+=e[0].length);return e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos){b!==!1&&(this.pos+=a.length);return!0}},current:function(){return this.string.slice(this.start,this.pos)}},g.prototype={replace:function(a,b,c){var d=[],e=this.marked;h(0,a,this.styles,d),c&&d.push(c,null),h(b,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(b),this.stateAfter=null;if(e){var f=c.length-(b-a),g=this.text.length;function i(a){return a<=Math.min(b,b+f)?a:a+f}for(var j=0;j=g?l=!0:(k.from=i(k.from),k.to!=null&&(k.to=i(k.to)));if(l||k.from>=k.to)e.splice(j,1),j--}}},split:function(a,b){var c=[b,null];h(a,this.text.length,this.styles,c);return new g(b+this.text.slice(a),c)},addMark:function(a,b,c){var d=this.marked,e={from:a,to:b,style:c};this.marked==null&&(this.marked=[]),this.marked.push(e),this.marked.sort(function(a,b){return a.from-b.from});return e},removeMark:function(a){var b=this.marked;if(!!b)for(var c=0;c5e3){d[e++]=this.text.slice(c.pos),d[e++]=null;break}}d.length!=e&&(d.length=e,g=!0),e&&d[e-2]!=i&&(g=!0);return g},getTokenAt:function(a,b,c){var d=this.text,e=new f(d);while(e.pos',B(a),""):e.push(B(a)))}var e=[];c&&e.push(this.className?'
':"
");var g=this.styles,h=this.text,i=this.marked;a==b&&(a=null);var j=h.length;d!=null&&(j=Math.min(d,j));if(!h&&d==null)f(" ",a!=null&&b==null?"CodeMirror-selected":null);else if(!i&&a==null)for(var k=0,l=0;lj&&(m=m.slice(0,j-l)),l+=n,f(m,g[k+1])}else{var o=0,k=0,p="",q,r=0,s=-1,t=null;function u(){i&&(s+=1,t=so)v=a;else if(b==null||b>o)w=" CodeMirror-selected",b!=null&&(v=Math.min(v,b));while(t&&t.to!=null&&t.to<=o)u();t&&(t.from>o?v=Math.min(v,t.from):(w+=" "+t.style,t.to!=null&&(v=Math.min(v,t.to))));for(;;){var x=o+p.length,y=q;w&&(y=q?q+w:w),f(x>v?p.slice(0,v-o):p,y);if(x>=v){p=p.slice(v-o),o=v;break}o=x,p=g[k++],q=g[k++]}}a!=null&&b==null&&f(" ","CodeMirror-selected")}c&&e.push("
");return e.join("")}},i.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1];if(d-this.time>400||!e||e.start>a+b||e.start+e.added=0;--g)e.old.unshift(c[g]);e.added+=e.start-a,e.start=a}else e.start-1&&(q="\r\n")})();var r=8,s=/Mac/.test(navigator.platform),t={};for(var u=35;u<=40;++u)t[u]=t["c"+u]=!0;if("\n\nb".split(/\n/).length!=3)var E=function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;d.push(a.slice(b));return d};else var E=function(a){return a.split(/\r?\n/)};if(window.getSelection)var F=function(a){try{return{start:a.selectionStart,end:a.selectionEnd}}catch(b){return null}},G=function(a,b,c){try{a.setSelectionRange(b,c)}catch(d){}};else var F=function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){return null}if(!b||b.parentElement()!=a)return null;var d=a.value,e=d.length,f=a.createTextRange();f.moveToBookmark(b.getBookmark());var g=a.createTextRange();g.collapse(!1);if(f.compareEndPoints("StartToEnd",g)>-1)return{start:e,end:e};var h=-f.moveStart("character",-e);for(var i=d.indexOf("\r");i>-1&&i-1)return{start:h,end:e};var j=-f.moveEnd("character",-e);for(var i=d.indexOf("\r");i>-1&&i-1&&h-1&&h=2&&f==">"){b.tokenize=e;break}c=f=="-"?c+1:0}return d("css-comment","comment")}function f(a,b){var c=!1,f;while((f=a.next())!=null){if(c&&f=="/"){b.tokenize=e;break}c=f=="*"}return d("css-comment","comment")}function e(a,b){var c=a.next();if(c=="@"){a.eatWhile(/\w/);return d("css-at",a.current())}if(c=="/"&&a.eat("*")){b.tokenize=f;return f(a,b)}if(c=="<"&&a.eat("!")){b.tokenize=g;return g(a,b)}if(c=="=")d(null,"compare");else{if(c!="~"&&c!="|"||!a.eat("=")){if(c=='"'||c=="'"){b.tokenize=h(c);return b.tokenize(a,b)}if(c=="#"){a.eatWhile(/\w/);return d("css-selector","hash")}if(c=="!"){a.match(/^\s*\w*/);return d("css-important","important")}if(/\d/.test(c)){a.eatWhile(/[\w.%]/);return d("css-unit","unit")}if(/[,.+>*\/]/.test(c))return d(null,"select-op");if(/[;{}:\[\]]/.test(c))return d(null,c);a.eatWhile(/[\w\\\-_]/);return d("css-identifier","identifier")}return d(null,"compare")}}function d(a,b){c=b;return a}var b=a.indentUnit,c;return{startState:function(a){return{tokenize:e,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e=="rule")d="css-colorcode";else if(d=="css-identifier")if(e=="rule")d="css-value";else if(!e||e=="@media{")d="css-selector";e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e!="rule"&&e!="@media"&&c!="comment"&&b.stack.push("rule");return d},indent:function(a,c){var d=a.stack.length;/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1);return a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css") \ No newline at end of file diff --git a/stylebot/js/libs/css-utils.js b/stylebot/js/libs/css-utils.js index 2ebc30ce..9e5a2c36 100644 --- a/stylebot/js/libs/css-utils.js +++ b/stylebot/js/libs/css-utils.js @@ -7,39 +7,39 @@ var CSSUtils = { /* e.g. of rules object used as input / output: - + rules = { - 'a.someclass': { + 'a.someclass': { 'color': '#fff', 'font-size': '12px' } } - + */ crunchCSS: function(rules, setImportant) { var css = ""; - + for (var selector in rules) { if (rules[selector]["comment"]) continue; css += selector + " { "; - + for (var property in rules[selector]) { - + if (property.indexOf("comment") != -1) continue; - + if (rules[selector][property].indexOf("!important") != -1) css += this.getCSSDeclaration(property, rules[selector][property], false); else css += this.getCSSDeclaration(property, rules[selector][property], setImportant); } - + css += " } "; } - + return css; }, - + crunchFormattedCSS: function(rules, setImportant) { var css = ""; for (var selector in rules) @@ -47,49 +47,49 @@ var CSSUtils = { if (rules[selector]["comment"]) { css += rules[selector]["comment"] + "\n"; } - + else { css += selector + " {" + "\n"; - + for (var property in rules[selector]) { if (property.indexOf("comment") != -1) { - css += "\t" + rules[selector][property] + "\n"; + css += " " + rules[selector][property] + "\n"; } - else { - css += "\t" + this.getCSSDeclaration(property, rules[selector][property], setImportant) + "\n"; + else { + css += " " + this.getCSSDeclaration(property, rules[selector][property], setImportant) + "\n"; } } - + css += "}" + "\n\n"; } } - + return css; }, - + // generate formatted CSS for selector crunchCSSForSelector: function(rules, selector, setImportant, formatted) { var css = ""; var append = ""; if (formatted) append = "\n" - + for (var property in rules[selector]) { if (property.indexOf("comment") != -1) continue; - - css += "\t" + this.getCSSDeclaration(property, rules[selector][property], setImportant) + "\n"; + + css += this.getCSSDeclaration(property, rules[selector][property], setImportant) + "\n"; } - + return css; }, - + getCSSDeclaration: function(property, value, setImportant) { if (setImportant) return property + ": " + value + " !important;"; else return property + ": " + value + ";"; }, - + injectCSS: function(css, id) { var style = document.createElement('style'); style.type = "text/css"; @@ -97,31 +97,41 @@ var CSSUtils = { style.setAttribute("id", id); style.appendChild(document.createTextNode(css)); document.documentElement.appendChild(style); - }, - + }, + // parser object is that returned by JSCSSP getRulesFromParserObject: function(sheet) { var rules = {}; var comment_index = 0; var len = sheet.cssRules.length; - for (var i = 0; i < len; i++) { - - if (sheet.cssRules[i] instanceof jscsspComment) { + + for (var i = 0; i < len; i++) + { + + if (sheet.cssRules[i] instanceof jscsspErrorRule) { + rules['error'] = sheet.cssRules[i]; + break; + } + + else if (sheet.cssRules[i] instanceof jscsspComment) { var selector = "comment-#"+comment_index++; rules[selector] = new Object(); rules[selector]["comment"] = sheet.cssRules[i].parsedCssText; } - + else { var selector = sheet.cssRules[i].mSelectorText; rules[selector] = new Object(); + var len2 = sheet.cssRules[i].declarations.length; + for (var j = 0; j < len2; j++) { + if (sheet.cssRules[i].declarations[j] instanceof jscsspComment) { rules[selector]["comment-#"+comment_index++] = sheet.cssRules[i].declarations[j].parsedCssText; } - + else { var property = sheet.cssRules[i].declarations[j].property; var value = sheet.cssRules[i].declarations[j].valueText; @@ -130,9 +140,10 @@ var CSSUtils = { } } } + return rules; }, - + // parser object is that returned by JSCSSP getRuleFromParserObject: function(sheet) { var rule = {}; @@ -142,28 +153,28 @@ var CSSUtils = { var value = sheet.cssRules[0].declarations[i].valueText; rule[property] = value; } - + return rule; }, - - // deprecated + + // @deprecated parseCSS: function(css) { var rules = {}; css = this.removeComments(css); var blocks = css.split('}'); blocks.pop(); var len = blocks.length; - + for (var i = 0; i < len; i++) { var pair = blocks[i].split('{'); rules[$.trim(pair[0])] = this.parseCSSBlock(pair[1]); } - + return rules; }, - - // deprecated. instead using http://www.glazman.org/JSCSSP/ + + // @deprecated. instead using http://www.glazman.org/JSCSSP/ parseCSSBlock: function(css) { var rule = {}; var declarations = css.split(';'); @@ -174,14 +185,14 @@ var CSSUtils = { var loc = declarations[i].indexOf(':'); var property = $.trim(declarations[i].substring(0, loc)); var value = $.trim(declarations[i].substring(loc+1)); - + if (property != "" && value != "") rule[property] = value; } - + return rule; }, - + // from http://www.senocular.com/pub/javascript/CSS_parse.js removeComments: function(css) { return css.replace(/\/\*(\r|\n|.)*\*\//g,""); diff --git a/stylebot/js/libs/jquery.js b/stylebot/js/libs/jquery.js index 48a88b8f..b2ac1747 100644 --- a/stylebot/js/libs/jquery.js +++ b/stylebot/js/libs/jquery.js @@ -1,154 +1,18 @@ /*! - * jQuery JavaScript Library v1.4.2 + * jQuery JavaScript Library v1.6.1 * http://jquery.com/ * - * Copyright 2010, John Resig + * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation + * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * - * Date: Sat Feb 13 22:33:48 2010 -0500 + * Date: Thu May 12 15:04:36 2011 -0400 */ -(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, -Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& -(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, -a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== -"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, -function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; -var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, -parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= -false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= -s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, -applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; -else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, -a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== -w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, -cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, -function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); -k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), -C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= -e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& -f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; -if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", -e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, -"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, -d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, -e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); -t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| -g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== -"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", -d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? -a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== -1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, -""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); -return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", -""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= -c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? -c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= -function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= -Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, -"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= -a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= -a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== -"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, -serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), -function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, -global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& -e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? -"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== -false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= -false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", -c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| -d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); -g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== -1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== -"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; -if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== -"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| -c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; -this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= -this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, -e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; -a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); -c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, -d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- -f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": -"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in -e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); \ No newline at end of file +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem +)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/stylebot/js/libs/parser.js b/stylebot/js/libs/parser.js index a51f24ce..2f367629 100644 --- a/stylebot/js/libs/parser.js +++ b/stylebot/js/libs/parser.js @@ -424,7 +424,7 @@ var CssInspector = { token.isFunction("-moz-repeating-radial-gradient(")) { gradient.isRepeating = true; } - + token = parser.getToken(true, true); var haveGradientLine = false; @@ -678,7 +678,7 @@ var CssInspector = { blurRadius = "0px"; spreadRadius = "0px" offsetX = "0px"; - offsetY = "0px"; + offsetY = "0px"; token = parser.getToken(true, true); } else if (!token.isNotNull()) @@ -701,7 +701,7 @@ var CssInspector = { var shadows = []; var token = parser.getToken(true, true); - var color = "", blurRadius = "0px", offsetX = "0px", offsetY = "0px"; + var color = "", blurRadius = "0px", offsetX = "0px", offsetY = "0px"; while (token.isNotNull()) { if (token.isIdent("none")) { shadows.push( { none: true } ); @@ -777,7 +777,7 @@ var CssInspector = { color = ""; blurRadius = "0px"; offsetX = "0px"; - offsetY = "0px"; + offsetY = "0px"; token = parser.getToken(true, true); } else if (!token.isNotNull()) @@ -885,7 +885,7 @@ var CssInspector = { return null; } else - return null; + return null; token = parser.getToken(true, true); if (token.isNumber() || token.isPercentage()) @@ -1447,7 +1447,7 @@ CSSScanner.prototype = { if (this.isWhiteSpace(c)) { var s = this.eatWhiteSpace(c); - + return new jscsspToken(jscsspToken.WHITESPACE_TYPE, s); } @@ -1489,7 +1489,7 @@ function CSSParser(aString) this.mPreserveComments = true; this.mPreservedTokens = []; - + this.mError = null; } @@ -1523,7 +1523,7 @@ CSSParser.prototype = { kCOLOR_NAMES: { "transparent": true, - + "black": true, "silver": true, "gray": true, @@ -1540,7 +1540,7 @@ CSSParser.prototype = { "blue": true, "teal": true, "aqua": true, - + "aliceblue": true, "antiquewhite": true, "aqua": true, @@ -1688,7 +1688,7 @@ CSSParser.prototype = { "whitesmoke": true, "yellow": true, "yellowgreen": true, - + "activeborder": true, "activecaption": true, "appworkspace": true, @@ -1736,7 +1736,7 @@ CSSParser.prototype = { "circle": true, "square": true, "none": true, - + /* CSS 3 */ "box": true, "check": true, @@ -1997,7 +1997,7 @@ CSSParser.prototype = { if (!media.length) { media.push("all"); } - + if (token.isSymbol(";")) { s += ";" this.forgetState(); @@ -2246,7 +2246,7 @@ CSSParser.prototype = { this.ungetToken(); break; } - + if (token.isIdent(this.kINHERIT)) { if (values.length) { return ""; @@ -2415,6 +2415,58 @@ CSSParser.prototype = { return top + " " + right + " " + bottom + " " + left; }, + stylebot_parseMarginOrPaddingShorthand: function(token, aDecl, aAcceptPriority, aProperty) + { + var top = null; + var bottom = null; + var left = null; + var right = null; + + var values = []; + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!values.length && token.isIdent(this.kINHERIT)) { + values.push(token.value); + token = this.getToken(true, true); + break; + } + + else if (token.isDimension() + || token.isNumber("0") + || token.isPercentage() + || token.isIdent("auto")) { + values.push(token.value); + } + else + return ""; + + token = this.getToken(true, true); + } + + this.forgetState(); + + var count = values.length; + var decl = ""; + if (count < 1 || count > 4) return ""; + for(var i = 0;i < count;i++) { + decl += values[i]; + if(i < count - 1) decl += " "; + } + aDecl.push(this._createJscsspDeclarationFromValue(aProperty, decl)); + return decl; + }, + parseBorderColorShorthand: function(token, aDecl, aAcceptPriority) { var top = null; @@ -2441,7 +2493,7 @@ CSSParser.prototype = { token = this.getToken(true, true); break; } - + else { var color = this.parseColor(token); if (color) @@ -2490,6 +2542,57 @@ CSSParser.prototype = { return top + " " + right + " " + bottom + " " + left; }, + stylebot_parseBorderColorShorthand: function(token, aDecl, aAcceptPriority) + { + var top = null; + var bottom = null; + var left = null; + var right = null; + + var values = []; + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!values.length && token.isIdent(this.kINHERIT)) { + values.push(token.value); + token = this.getToken(true, true); + break; + } + + else { + var color = this.parseColor(token); + if (color) + values.push(color); + else + return ""; + } + + token = this.getToken(true, true); + } + + this.forgetState(); + + var count = values.length; + var decl = ""; + if (count < 1 || count > 4) return ""; + for(var i = 0;i < count;i++) { + decl += values[i]; + if(i < count - 1) decl += " "; + } + aDecl.push(this._createJscsspDeclarationFromValue("border-color", decl)); + return decl; + }, + parseCueShorthand: function(token, declarations, aAcceptPriority) { var before = ""; @@ -2550,6 +2653,60 @@ CSSParser.prototype = { return before + " " + after; }, + stylebot_parseCueShorthand: function(token, declarations, aAcceptPriority) + { + var before = ""; + var after = ""; + + var values = []; + var values = []; + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!values.length && token.isIdent(this.kINHERIT)) { + values.push(token.value); + } + + else if (token.isIdent("none")) + values.push(token.value); + + else if (token.isFunction("url(")) { + var token = this.getToken(true, true); + var urlContent = this.parseURL(token); + if (urlContent) + values.push("url(" + urlContent); + else + return ""; + } + else + return ""; + + token = this.getToken(true, true); + } + + this.forgetState(); + + var count = values.length; + var decl = ""; + if (count < 1 || count > 2) return ""; + for(var i = 0;i < count;i++) { + decl += values[i]; + if(i < count - 1) decl += " "; + } + aDecl.push(this._createJscsspDeclarationFromValue("cue", decl)); + return decl; + }, + parsePauseShorthand: function(token, declarations, aAcceptPriority) { var before = ""; @@ -2604,6 +2761,54 @@ CSSParser.prototype = { return before + " " + after; }, + stylebot_parsePauseShorthand: function(token, declarations, aAcceptPriority) + { + var before = ""; + var after = ""; + + var values = []; + var values = []; + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!values.length && token.isIdent(this.kINHERIT)) { + values.push(token.value); + } + + else if (token.isDimensionOfUnit("ms") + || token.isDimensionOfUnit("s") + || token.isPercentage() + || token.isNumber("0")) + values.push(token.value); + else + return ""; + + token = this.getToken(true, true); + } + + this.forgetState(); + + var count = values.length; + var decl = ""; + if (count < 1 || count > 2) return ""; + for(var i = 0;i < count;i++) { + decl += values[i]; + if(i < count - 1) decl += " "; + } + aDecl.push(this._createJscsspDeclarationFromValue("pause", decl)); + return decl; + }, + parseBorderWidthShorthand: function(token, aDecl, aAcceptPriority) { var top = null; @@ -2628,7 +2833,7 @@ CSSParser.prototype = { else if (!values.length && token.isIdent(this.kINHERIT)) { values.push(token.value); } - + else if (token.isDimension() || token.isNumber("0") || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES)) { @@ -2677,6 +2882,55 @@ CSSParser.prototype = { return top + " " + right + " " + bottom + " " + left; }, + stylebot_parseBorderWidthShorthand: function(token, aDecl, aAcceptPriority) + { + var top = null; + var bottom = null; + var left = null; + var right = null; + + var values = []; + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!values.length && token.isIdent(this.kINHERIT)) { + values.push(token.value); + } + + else if (token.isDimension() + || token.isNumber("0") + || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES)) { + values.push(token.value); + } + else + return ""; + + token = this.getToken(true, true); + } + + this.forgetState(); + + var count = values.length; + var decl = ""; + if (count < 1 || count > 4) return ""; + for(var i = 0;i < count;i++) { + decl += values[i]; + if(i < count - 1) decl += " "; + } + aDecl.push(this._createJscsspDeclarationFromValue("border-width", decl)); + return decl; + }, + parseBorderStyleShorthand: function(token, aDecl, aAcceptPriority) { var top = null; @@ -2701,7 +2955,7 @@ CSSParser.prototype = { else if (!values.length && token.isIdent(this.kINHERIT)) { values.push(token.value); } - + else if (token.isIdent() && token.value in this.kBORDER_STYLE_NAMES) { values.push(token.value); } @@ -2748,13 +3002,16 @@ CSSParser.prototype = { return top + " " + right + " " + bottom + " " + left; }, - parseBorderEdgeOrOutlineShorthand: function(token, aDecl, aAcceptPriority, aProperty) + stylebot_parseBorderStyleShorthand: function(token, aDecl, aAcceptPriority) { - var bWidth = null; - var bStyle = null; - var bColor = null; + var top = null; + var bottom = null; + var left = null; + var right = null; + var values = []; while (true) { + if (!token.isNotNull()) break; @@ -2766,18 +3023,62 @@ CSSParser.prototype = { break; } - else if (!bWidth && !bStyle && !bColor - && token.isIdent(this.kINHERIT)) { - bWidth = this.kINHERIT; - bStyle = this.kINHERIT; - bColor = this.kINHERIT; + else if (!values.length && token.isIdent(this.kINHERIT)) { + values.push(token.value); } - else if (!bWidth && - (token.isDimension() - || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES) - || token.isNumber("0"))) { - bWidth = token.value; + else if (token.isIdent() && token.value in this.kBORDER_STYLE_NAMES) { + values.push(token.value); + } + else + return ""; + + token = this.getToken(true, true); + } + + this.forgetState(); + + var count = values.length; + var decl = ""; + if (count < 1 || count > 4) return ""; + for(var i = 0;i < count;i++) { + decl += values[i]; + if(i < count - 1) decl += " "; + } + aDecl.push(this._createJscsspDeclarationFromValue("border-style", decl)); + return decl; + }, + + parseBorderEdgeOrOutlineShorthand: function(token, aDecl, aAcceptPriority, aProperty) + { + var bWidth = null; + var bStyle = null; + var bColor = null; + + while (true) { + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!bWidth && !bStyle && !bColor + && token.isIdent(this.kINHERIT)) { + bWidth = this.kINHERIT; + bStyle = this.kINHERIT; + bColor = this.kINHERIT; + } + + else if (!bWidth && + (token.isDimension() + || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES) + || token.isNumber("0"))) { + bWidth = token.value; } else if (!bStyle && @@ -2819,6 +3120,64 @@ CSSParser.prototype = { return bWidth + " " + bStyle + " " + bColor; }, + stylebot_parseBorderEdgeOrOutlineShorthand: function(token, aDecl, aAcceptPriority, aProperty) + { + var bWidth = null; + var bStyle = null; + var bColor = null; + + while (true) { + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!bWidth && !bStyle && !bColor + && token.isIdent(this.kINHERIT)) { + bWidth = this.kINHERIT; + bStyle = this.kINHERIT; + bColor = this.kINHERIT; + } + + else if (!bWidth && + (token.isDimension() + || (token.isIdent() && token.value in this.kBORDER_WIDTH_NAMES) + || token.isNumber("0"))) { + bWidth = token.value; + } + + else if (!bStyle && + (token.isIdent() && token.value in this.kBORDER_STYLE_NAMES)) { + bStyle = token.value; + } + + else { + var color = (aProperty == "outline" && token.isIdent("invert")) + ? "invert" : this.parseColor(token); + if (!bColor && color) + bColor = color; + else + return ""; + } + token = this.getToken(true, true); + } + + // create the declarations + this.forgetState(); + var decl = ""; + decl += bWidth ? bWidth : ""; + decl += bStyle ? (bWidth ? " " : "" ) + bStyle : ""; + decl += bColor ? (bWidth || bStyle ? " " : "" ) + bColor : ""; + aDecl.push(this._createJscsspDeclarationFromValue(aProperty, decl)); + return decl; + }, + parseBackgroundShorthand: function(token, aDecl, aAcceptPriority) { var kHPos = {"left": true, "right": true }; @@ -2945,6 +3304,128 @@ CSSParser.prototype = { return bgColor + " " + bgImage + " " + bgRepeat + " " + bgAttachment + " " + bgPosition; }, + stylebot_parseBackgroundShorthand: function(token, aDecl, aAcceptPriority) + { + var kHPos = {"left": true, "right": true }; + var kVPos = {"top": true, "bottom": true }; + var kPos = {"left": true, "right": true, "top": true, "bottom": true, "center": true}; + + var bgColor = null; + var bgRepeat = null; + var bgAttachment = null; + var bgImage = null; + var bgPosition = null; + + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!bgColor && !bgRepeat && !bgAttachment && !bgImage && !bgPosition + && token.isIdent(this.kINHERIT)) { + bgColor = this.kINHERIT; + bgRepeat = this.kINHERIT; + bgAttachment = this.kINHERIT; + bgImage = this.kINHERIT; + bgPosition = this.kINHERIT; + } + + else { + if (!bgAttachment && + (token.isIdent("scroll") + || token.isIdent("fixed"))) { + bgAttachment = token.value; + } + + else if (!bgPosition && + ((token.isIdent() && token.value in kPos) + || token.isDimension() + || token.isNumber("0") + || token.isPercentage())) { + bgPosition = token.value; + token = this.getToken(true, true); + if (token.isDimension() || token.isNumber("0") || token.isPercentage()) { + bgPosition += " " + token.value; + } + else if (token.isIdent() && token.value in kPos) { + if ((bgPosition in kHPos && token.value in kHPos) || + (bgPosition in kVPos && token.value in kVPos)) + return ""; + bgPosition += " " + token.value; + } + else { + this.ungetToken(); + bgPosition += " center"; + } + } + + else if (!bgRepeat && + (token.isIdent("repeat") + || token.isIdent("repeat-x") + || token.isIdent("repeat-y") + || token.isIdent("no-repeat"))) { + bgRepeat = token.value; + } + + else if (!bgImage && + (token.isFunction("url(") + || token.isIdent("none"))) { + bgImage = token.value; + if (token.isFunction("url(")) { + token = this.getToken(true, true); + var url = this.parseURL(token); // TODO + if (url) + bgImage += url; + else + return ""; + } + } + + else if (!bgImage && + (token.isFunction("-moz-linear-gradient(") + || token.isFunction("-moz-radial-gradient(") + || token.isFunction("-moz-repeating-linear-gradient(") + || token.isFunction("-moz-repeating-radial-gradient("))) { + var gradient = CssInspector.parseGradient(this, token); + if (gradient) + bgImage = CssInspector.serializeGradient(gradient); + else + return ""; + } + + else { + var color = this.parseColor(token); + if (!bgColor && color) + bgColor = color; + else + return ""; + } + + } + + token = this.getToken(true, true); + } + + // create the declarations + this.forgetState(); + var decl = ""; + decl += bgColor ? bgColor : ""; + decl += bgImage ? ( bgColor ? " " : "" ) + bgImage : ""; + decl += bgRepeat ? ( bgColor || bgImage ? " " : "" ) + bgRepeat : ""; + decl += bgAttachment ? ( bgColor || bgImage || bgRepeat ? " " : "" ) + bgAttachment : ""; + decl += bgPosition ? ( bgColor || bgImage || bgRepeat || bgAttachment ? " " : "" ) + bgPosition : ""; + aDecl.push(this._createJscsspDeclarationFromValue("background", decl)); + return decl; + }, + parseListStyleShorthand: function(token, aDecl, aAcceptPriority) { var kPosition = { "inside": true, "outside": true }; @@ -3010,6 +3491,70 @@ CSSParser.prototype = { return lType + " " + lPosition + " " + lImage; }, + stylebot_parseListStyleShorthand: function(token, aDecl, aAcceptPriority) + { + var kPosition = { "inside": true, "outside": true }; + + var lType = null; + var lPosition = null; + var lImage = null; + + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!lType && !lPosition && ! lImage + && token.isIdent(this.kINHERIT)) { + lType = this.kINHERIT; + lPosition = this.kINHERIT; + lImage = this.kINHERIT; + } + + else if (!lType && + (token.isIdent() && token.value in this.kLIST_STYLE_TYPE_NAMES)) { + lType = token.value; + } + + else if (!lPosition && + (token.isIdent() && token.value in kPosition)) { + lPosition = token.value; + } + + else if (!lImage && token.isFunction("url")) { + token = this.getToken(true, true); + var urlContent = this.parseURL(token); + if (urlContent) { + lImage = "url(" + urlContent; + } + else + return ""; + } + else if (!token.isIdent("none")) + return ""; + + token = this.getToken(true, true); + } + + // create the declarations + this.forgetState(); + + var decl = ""; + decl += lType ? lType : ""; + decl += lImage ? ( lType ? " " : "" ) + lImage : ""; + decl += lPosition ? ( lType || lImage ? " " : "" ) + lPosition : ""; + aDecl.push(this._createJscsspDeclarationFromValue("list-style", decl)); + return decl; + }, + parseFontShorthand: function(token, aDecl, aAcceptPriority) { var kStyle = {"italic": true, "oblique": true }; @@ -3072,19 +3617,19 @@ CSSParser.prototype = { && (token.value in kStyle)) { fStyle = token.value; } - + else if (!fVariant && token.isIdent() && (token.value in kVariant)) { fVariant = token.value; } - + else if (!fWeight && (token.isIdent() || token.isNumber()) && (token.value in kWeight)) { fWeight = token.value; } - + else if (!fSize && ((token.isIdent() && (token.value in kSize)) || token.isDimension() @@ -3179,6 +3724,171 @@ CSSParser.prototype = { return fStyle + " " + fVariant + " " + fWeight + " " + fSize + "/" + fLineHeight + " " + fFamily; }, + stylebot_parseFontShorthand: function(token, aDecl, aAcceptPriority) + { + var kStyle = {"italic": true, "oblique": true }; + var kVariant = {"small-caps": true }; + var kWeight = { "bold": true, "bolder": true, "lighter": true, + "100": true, "200": true, "300": true, "400": true, + "500": true, "600": true, "700": true, "800": true, + "900": true }; + var kSize = { "xx-small": true, "x-small": true, "small": true, "medium": true, + "large": true, "x-large": true, "xx-large": true, + "larger": true, "smaller": true }; + var kValues = { "caption": true, "icon": true, "menu": true, "message-box": true, "small-caption": true, "status-bar": true }; + var kFamily = { "serif": true, "sans-serif": true, "cursive": true, "fantasy": true, "monospace": true }; + + var fStyle = null; + var fVariant = null; + var fWeight = null; + var fSize = null; + var fLineHeight = null; + var fFamily = ""; + var fSystem = null; + var fFamilyValues = []; + + var normalCount = 0; + while (true) { + + if (!token.isNotNull()) + break; + + if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + if (token.isSymbol("}")) + this.ungetToken(); + break; + } + + else if (!fStyle && !fVariant && !fWeight + && !fSize && !fLineHeight && !fFamily + && !fSystem + && token.isIdent(this.kINHERIT)) { + fStyle = this.kINHERIT; + fVariant = this.kINHERIT; + fWeight = this.kINHERIT; + fSize = this.kINHERIT; + fLineHeight = this.kINHERIT; + fFamily = this.kINHERIT; + fSystem = this.kINHERIT; + } + + else { + if (!fSystem && (token.isIdent() && token.value in kValues)) { + fSystem = token.value; + break; + } + + else { + if (!fStyle + && token.isIdent() + && (token.value in kStyle)) { + fStyle = token.value; + } + + else if (!fVariant + && token.isIdent() + && (token.value in kVariant)) { + fVariant = token.value; + } + + else if (!fWeight + && (token.isIdent() || token.isNumber()) + && (token.value in kWeight)) { + fWeight = token.value; + } + + else if (!fSize + && ((token.isIdent() && (token.value in kSize)) + || token.isDimension() + || token.isPercentage())) { + fSize = token.value; + var token = this.getToken(false, false); + if (token.isSymbol("/")) { + token = this.getToken(false, false); + if (!fLineHeight && + (token.isDimension() || token.isNumber() || token.isPercentage())) { + fLineHeight = token.value; + } + else + return ""; + } + else + this.ungetToken(); + } + + else if (token.isIdent("normal")) { + normalCount++; + if (normalCount > 3) + return ""; + } + + else if (!fFamily && // *MUST* be last to be tested here + (token.isString() + || token.isIdent())) { + var lastWasComma = false; + while (true) { + if (!token.isNotNull()) + break; + else if (token.isSymbol(";") + || (aAcceptPriority && token.isSymbol("!")) + || token.isSymbol("}")) { + this.ungetToken(); + break; + } + else if (token.isIdent() && token.value in kFamily) { + var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, null); + value.value = token.value; + fFamilyValues.push(value); + fFamily += token.value; + break; + } + else if (token.isString() || token.isIdent()) { + var value = new jscsspVariable(kJscsspPRIMITIVE_VALUE, null); + value.value = token.value; + fFamilyValues.push(value); + fFamily += token.value; + lastWasComma = false; + } + else if (!lastWasComma && token.isSymbol(",")) { + fFamily += ", "; + lastWasComma = true; + } + else + return ""; + token = this.getToken(true, true); + } + } + + else { + return ""; + } + } + + } + + token = this.getToken(true, true); + } + + // create the declarations + this.forgetState(); + if (fSystem) { + aDecl.push(this._createJscsspDeclarationFromValue("font", fSystem)); + return fSystem; + } + + var decl = ""; + decl += fStyle ? fStyle : ""; + decl += fVariant ? ( fStyle ? " " : "" ) + fVariant : ""; + decl += fWeight ? ( fStyle || fVariant ? " " : "" ) + fWeight : ""; + decl += fSize ? ( fStyle || fVariant || fWeight ? " " : "" ) + fSize : ""; + decl += (fSize && fLineHeight) ? "/" + fLineHeight : ""; + decl += fFamily ? ( fStyle || fVariant || fWeight || fSize ? " " : "" ) + fFamily : ""; + aDecl.push(this._createJscsspDeclarationFromValue("font", decl)); + return decl; + }, + _createJscsspDeclaration: function(property, value) { var decl = new jscsspDeclaration(); @@ -3293,7 +4003,7 @@ CSSParser.prototype = { if (!token.isSymbol(",")) return ""; color += ", "; - + token = this.getToken(true, true); if (!token.isNumber() && !token.isPercentage()) return ""; @@ -3302,30 +4012,30 @@ CSSParser.prototype = { if (!token.isSymbol(",")) return ""; color += ", "; - + token = this.getToken(true, true); if (!token.isNumber() && !token.isPercentage()) return ""; color += token.value; - + if (isRgba) { token = this.getToken(true, true); if (!token.isSymbol(",")) return ""; color += ", "; - + token = this.getToken(true, true); if (!token.isNumber()) return ""; color += token.value; } - + token = this.getToken(true, true); if (!token.isSymbol(")")) return ""; color += token.value; } - + else if (token.isFunction("hsl(") || token.isFunction("hsla(")) { color = token.value; @@ -3338,7 +4048,7 @@ CSSParser.prototype = { if (!token.isSymbol(",")) return ""; color += ", "; - + token = this.getToken(true, true); if (!token.isPercentage()) return ""; @@ -3347,24 +4057,24 @@ CSSParser.prototype = { if (!token.isSymbol(",")) return ""; color += ", "; - + token = this.getToken(true, true); if (!token.isPercentage()) return ""; color += token.value; - + if (isHsla) { token = this.getToken(true, true); if (!token.isSymbol(",")) return ""; color += ", "; - + token = this.getToken(true, true); if (!token.isNumber()) return ""; color += token.value; } - + token = this.getToken(true, true); if (!token.isSymbol(")")) return ""; @@ -3403,20 +4113,21 @@ CSSParser.prototype = { if (aExpandShorthands) switch (descriptor) { case "background": - value = this.parseBackgroundShorthand(token, declarations, aAcceptPriority); + // @rduenasf the next line was changed so we can avoid the declaration breakdown + value = this.stylebot_parseBackgroundShorthand(token, declarations, aAcceptPriority); break; case "margin": case "padding": - value = this.parseMarginOrPaddingShorthand(token, declarations, aAcceptPriority, descriptor); + value = this.stylebot_parseMarginOrPaddingShorthand(token, declarations, aAcceptPriority, descriptor); break; case "border-color": - value = this.parseBorderColorShorthand(token, declarations, aAcceptPriority); + value = this.stylebot_parseBorderColorShorthand(token, declarations, aAcceptPriority); break; case "border-style": - value = this.parseBorderStyleShorthand(token, declarations, aAcceptPriority); + value = this.stylebot_parseBorderStyleShorthand(token, declarations, aAcceptPriority); break; case "border-width": - value = this.parseBorderWidthShorthand(token, declarations, aAcceptPriority); + value = this.stylebot_parseBorderWidthShorthand(token, declarations, aAcceptPriority); break; case "border-top": case "border-right": @@ -3424,19 +4135,20 @@ CSSParser.prototype = { case "border-left": case "border": case "outline": - value = this.parseBorderEdgeOrOutlineShorthand(token, declarations, aAcceptPriority, descriptor); + // @rduenasf the next line was changed so we can avoid the declaration breakdown + value = this.stylebot_parseBorderEdgeOrOutlineShorthand(token, declarations, aAcceptPriority, descriptor); break; case "cue": - value = this.parseCueShorthand(token, declarations, aAcceptPriority); + value = this.stylebot_parseCueShorthand(token, declarations, aAcceptPriority); break; case "pause": - value = this.parsePauseShorthand(token, declarations, aAcceptPriority); + value = this.stylebot_parsePauseShorthand(token, declarations, aAcceptPriority); break; case "font": - value = this.parseFontShorthand(token, declarations, aAcceptPriority); + value = this.stylebot_parseFontShorthand(token, declarations, aAcceptPriority); break; case "list-style": - value = this.parseListStyleShorthand(token, declarations, aAcceptPriority); + value = this.stylebot_parseListStyleShorthand(token, declarations, aAcceptPriority); break; default: value = this.parseDefaultPropertyValue(token, declarations, aAcceptPriority, descriptor, aSheet); @@ -3683,11 +4395,14 @@ CSSParser.prototype = { if (token.isWhiteSpace()) s += " "; else - s += token.value; + s += token.value + " "; if (token.isSymbol(">") || token.isSymbol("+") || token.isSymbol("~")) combinatorFound = true; + /* @rduenasf Fix: If there's a whitespace or a combinator, it should threat the next + token as the first in chain, this allows selectors like 'ul li' or 'ul > li' to work */ + isFirstInChain = true; token = this.getToken(true, true); continue; } @@ -3731,7 +4446,7 @@ CSSParser.prototype = { { var s = ""; var specificity = {a: 0, b: 0, c: 0, d: 0}; // CSS 2.1 section 6.4.3 - + if (isFirstInChain && (token.isSymbol("*") || token.isSymbol("|") || token.isIdent())) { // type or universal selector @@ -3771,7 +4486,7 @@ CSSParser.prototype = { return null; } } - + else if (token.isSymbol(".") || token.isSymbol("#")) { var isClass = token.isSymbol("."); s += token.value; @@ -3837,7 +4552,7 @@ CSSParser.prototype = { } } else return null; - + } else if (token.isSymbol("[")) { s += "["; token = this.getToken(true, true); @@ -3863,7 +4578,7 @@ CSSParser.prototype = { } else return null; - + // nothing, =, *=, $=, ^=, |= token = this.getToken(true, true); if (token.isIncludes() @@ -3880,7 +4595,7 @@ CSSParser.prototype = { } else return null; - + if (token.isSymbol("]")) { s += token.value; specificity.c++; @@ -3894,7 +4609,7 @@ CSSParser.prototype = { } else return null; - + } else if (token.isWhiteSpace()) { var t = this.lookAhead(true, true); @@ -4238,7 +4953,7 @@ jscsspStylesheet.prototype = { return true; return false; } - + for (var i = 0; i < this.cssRules.length; i++) { var rule = this.cssRules[i]; @@ -4246,7 +4961,7 @@ jscsspStylesheet.prototype = { break; else if (rule.type == kJscsspVARIABLES_RULE && (!rule.media.length || ItemFoundInArray(rule.media, aMedium))) { - + for (var j = 0; j < rule.declarations.length; j++) { var valueText = ""; for (var k = 0; k < rule.declarations[j].values.length; k++) @@ -4295,7 +5010,7 @@ jscsspCharsetRule.prototype = { function jscsspErrorRule(aErrorMsg) { - this.error = aErrorMsg ? aErrorMsg : "INVALID"; + this.error = aErrorMsg ? aErrorMsg : "INVALID"; this.type = kJscsspUNKNOWN_RULE; this.parsedCssText = null; this.parentStyleSheet = null; @@ -4356,7 +5071,7 @@ function jscsspImportRule() this.type = kJscsspIMPORT_RULE; this.parsedCssText = null; this.href = null; - this.media = []; + this.media = []; this.parentStyleSheet = null; this.parentRule = null; } @@ -4839,7 +5554,7 @@ function ParseURL(buffer) { if(buffer.charAt(start) == ':') { section = "AFTER_PROTOCOL"; start++; - } else if(buffer.charAt(start) == '/' && result.protocol.length() == 0) { + } else if(buffer.charAt(start) == '/' && result.protocol.length() == 0) { section = PATH; } else { result.protocol += buffer.charAt(start++); @@ -4855,7 +5570,7 @@ function ParseURL(buffer) { start ++; } else { throw new ParseException("Protocol shell be separated with 2 slashes"); - } + } } else if(section == "USER") { if(buffer.charAt(start) == '/') { result.host = result.user; diff --git a/stylebot/js/libs/selectorGenerator.js b/stylebot/js/libs/selectorGenerator.js index eaee42bd..ca451c59 100644 --- a/stylebot/js/libs/selectorGenerator.js +++ b/stylebot/js/libs/selectorGenerator.js @@ -6,73 +6,106 @@ **/ var SelectorGenerator = { - + generate: function(el, granularityLevel) { - if (!el) - return null; - el = $(el); - if (granularityLevel == 'low') - return this.inspectLow(el); - else if (granularityLevel == 'high') - return this.inspectHigh(el, 0); - else - return this.inspect(el, 0); + if (!el) + return null; + + $el = $(el); + + if (granularityLevel === 'low') + return this.inspectLow($el); + + else if (granularityLevel === 'high') + return this.inspectHigh($el, 0); + + else + return this.inspect($el, 0); }, - + // inspect an element and return a CSS selector for it. this is the default mode inspect: function(el, level) { - var elId = el.attr('id'); - var elClass = $.trim(el.attr("class").replace('stylebot-selected', '')); - - if (elClass.length != 0) - { - var classes = elClass.split(" "); - var len = classes.length; - var response = el[0].tagName.toLowerCase(); - - for (var i = 0; i < len; i++) - response += "." + classes[i]; - - return response; + var elClass = el.attr("class"); + + if (elClass != undefined) { + elClass = $.trim(elClass.replace('stylebot-selected', '')); + + if (elClass.length != 0) + { + var classes = elClass.split(" "); + var len = classes.length; + + var selector = el.prop('tagName'); + selector = selector ? selector.toLowerCase() : ""; + + for (var i = 0; i < len; i++) + selector += "." + classes[i]; + + return selector; + } } - - if (elId.length != 0) + + var elId = el.attr('id'); + if (elId != undefined) { return "#" + elId; } - + + var elTag = el.prop('tagName'); + elTag = elTag ? elTag.toLowerCase() : ""; + // don't go beyond 2 levels up + // if (level < 2) - return this.inspect(el.parent(), level + 1) + " " + el[0].tagName.toLowerCase(); + return this.inspect(el.parent(), level + 1) + " " + elTag; else - return el[0].tagName.toLowerCase(); + return elTag; }, - + inspectHigh: function(el, level) { var elId = el.attr('id'); - if (elId.length != 0) + + if (elId != undefined) return "#" + elId; - - var elClass = $.trim(el.attr("class").replace('stylebot-selected', '')); - var elTag = el[0].tagName.toLowerCase(); - var val; - + + var elClass = el.attr("class"); + + if (elClass != undefined) { + elClass = $.trim(elClass.replace('stylebot-selected', '')); + } + + else { + elClass = ""; + } + + var elTag = el.prop('tagName'); + elTag = elTag ? elTag.toLowerCase : ""; + + var selector; + if (level < 1) { - val = this.inspectHigh(el.parent(), level + 1) + " " + elTag; - if (elClass.length != 0) - val += "." + elClass; + selector = this.inspectHigh(el.parent(), level + 1) + " " + elTag; + + if (elClass.length != 0) { + selector += "." + elClass; + } } + else { - val = elTag; - if (elClass.length != 0) - val += "." + elClass; + selector = elTag; + + if (elClass.length != 0) { + selector += "." + elClass; + } } - return val; + + return selector; }, - + inspectLow: function(el) { - return el[0].tagName.toLowerCase(); + var elTag = el.prop('tagName'); + return elTag ? elTag.toLowerCase() : ""; } }; \ No newline at end of file diff --git a/stylebot/js/libs/utils.js b/stylebot/js/libs/utils.js index 9c48001f..86c49b59 100644 --- a/stylebot/js/libs/utils.js +++ b/stylebot/js/libs/utils.js @@ -6,7 +6,7 @@ **/ var Utils = { - + // return array index at which property pName is equal to value 'pValue' search: function(arr, pName, pValue) { var len = arr.length; @@ -15,10 +15,10 @@ var Utils = { if (arr[i][pName] == pValue) return i; } - + return null; }, - + // if any of the passed keys is pressed, returns false. // Accepts a keys array and 'keyup' event object as arguments. // TODO: Add support for keydown, keypress events and alphanumeric keys @@ -56,11 +56,11 @@ var Utils = { } return true; }, - + capitalize: function(string) { return string.charAt(0).toUpperCase() + string.slice(1); }, - + makeEditable: function(el, callback, options) { el.bind('click keyup', {callback: callback}, function(e) { if (e.type == 'keyup' && e.keyCode != 13) @@ -68,13 +68,13 @@ var Utils = { var el = $(this); el.hide(); - + var elWidth; if (options && options.fixedWidth) elWidth = options.fixedWidth; - else + else elWidth = el.width(); - + var value = el.text(); // create a textfield var input = $('', { @@ -84,7 +84,7 @@ var Utils = { id: 'stylebot-editing-field' }) .width(elWidth); - + el.before(input); input.focus(); @@ -108,22 +108,31 @@ var Utils = { $(document).unbind("mousedown", onClose); $(document).unbind("keyup", onClose); } - + input.bind('keyup', {input: input, el: el, callback: callback}, onClose); $(document).bind('mousedown',{input: input, el: el, callback: callback}, onClose); }); }, - + + selectText: function(el, start, end) { + if (!el || !el.value || el.value === "") + return false; + var len = el.value.length; + if (end > len) end = len; + el.setSelectionRange(start, end); + return true; + }, + selectAllText: function(el) { - if (!el || !el.value || el.value == "") + if (!el || !el.value || el.value === "") return false; var len = el.value.length; el.setSelectionRange(0, len); return true; }, - + moveCursorToEnd: function(el) { - if (!el || !el.value || el.value == "") + if (!el || !el.value || el.value === "") return false; var len = el.value.length; el.setSelectionRange(len, len); @@ -131,7 +140,7 @@ var Utils = { el.scrollTop = el.scrollHeight; } }, - + HTMLDecode: function(text) { if (text && typeof(text) != "undefined") { @@ -139,11 +148,11 @@ var Utils = { return text.replace("<", "<").replace(">", ">"); } }, - + // To copy an object. from: http://my.opera.com/GreyWyvern/blog/show.dml/1725165 cloneObject: function(obj) { var newObj = (obj instanceof Array) ? [] : {}; - + for (i in obj) { if (obj[i] && typeof obj[i] == "object") @@ -153,7 +162,7 @@ var Utils = { else newObj[i] = obj[i] } - + return newObj; } } \ No newline at end of file diff --git a/stylebot/js/options.js b/stylebot/js/options.js index 72829777..79f05aaf 100644 --- a/stylebot/js/options.js +++ b/stylebot/js/options.js @@ -7,8 +7,7 @@ $(document).ready(function() { var bg_window = null; var cache = { - modal: null, - textareaHeight: null + modal: null } // options with their default values @@ -76,11 +75,6 @@ function init() { attachListeners(); initFiltering(); updateSyncUI(); - - // hack to wait for window.innerHeight to be available - setTimeout(function() { - cache.textareaHeight = window.innerHeight * 0.5 + 'px'; - }, 100); } // Initialize tabs @@ -121,26 +115,26 @@ function fetchOptions() { // Attaches listeners for different types of inputs that change option values function attachListeners() { // checkbox - $('.option label input[type=checkbox]').change(function(e) { + $('.option input[type=checkbox]').change(function(e) { var name = e.target.name; var value = translateOptionValue(name, e.target.checked); bg_window.saveOption(name, value); }); // radio - $('.option label input[type=radio]').change(function(e) { + $('.option input[type=radio]').change(function(e) { var name = e.target.name; var value = translateOptionValue(name, e.target.value); bg_window.saveOption(name, value); }); // select - $('.option label select').change(function(e) { + $('.option select').change(function(e) { bg_window.saveOption(e.target.name, e.target.value); }); // textfields - $('.option label input[type=text]').keyup(function(e) { + $('.option input[type=text]').keyup(function(e) { if (e.target.name == "shortcutKeyCharacter") option = "shortcutKey"; else @@ -164,8 +158,9 @@ function translateOptionValue(name, value) { function fillCustomStyles() { var container = $("#custom-styles"); container.html(""); - for (var url in styles) { + // skip the global styles + if(url == "*") continue; container.append(createCustomStyleOption(url)); } } @@ -221,8 +216,10 @@ function createCustomStyleOption(url) { function removeStyle(e) { var parent = $(e.target).parents('.custom-style'); var url = parent.find('.custom-style-url'); + delete styles[url.html()]; parent.remove(); + bg_window.saveStyles(styles); bg_window.pushStyles(); } @@ -234,22 +231,103 @@ function editStyle(e) { var rules = styles[url]['_rules']; var css = CSSUtils.crunchFormattedCSS(rules, false); - var html = "
Edit the CSS for " + url + ":
"; - html += ""; - html += ""; - html += ""; + var html = " \ +
\ + \ + \ +
"; initModal(html); cache.modal.options.onOpen = function() { - var textarea = cache.modal.box.find('textarea').get(0); - textarea.focus(); - Utils.moveCursorToEnd(textarea); + var attachTo = cache.modal.box.find("div").get(0); + cache.modal.editor = CodeMirror(attachTo, { + value: css, + mode: "css", + lineNumbers: true, + indentUnit: 4, + onFocus: function() { cache.modal.editor.clearMarker(cache.modal.editor.errorLine); } + }); + cache.modal.editor.errorLine = 0; + cache.modal.editor.setCursor(cache.modal.editor.lineCount(), 0); + }; + + cache.modal.show(); +} + +// Displays the modal popup for editing the global stylesheet +function editGlobalStylesheet(e) { + if (styles["*"]){ + var rules = styles["*"]['_rules']; + var css = CSSUtils.crunchFormattedCSS(rules, false); + } + else { + var css = ""; + } + + var html = " \ +
\ + \ + \ +
"; + + initModal(html); + + cache.modal.options.onOpen = function() { + var attachTo = cache.modal.box.find("div").get(0); + cache.modal.editor = CodeMirror(attachTo, { + value: css, + mode: "css", + lineNumbers: true, + indentUnit: 4, + onFocus: function() { cache.modal.editor.clearMarker(cache.modal.editor.errorLine); } + }); + cache.modal.editor.errorLine = 0; + cache.modal.editor.setCursor(cache.modal.editor.lineCount(), 0); + }; + + cache.modal.show(); +} + + +// Displays the modal popup to add a new style +function addStyle() { + var html = " \ +
\ + \ + \ +
"; + + initModal(html); + + cache.modal.options.onOpen = function() { + var attachTo = cache.modal.box.find("div").get(0); + + cache.modal.editor = CodeMirror(attachTo, { + mode: "css", + lineNumbers: true, + indentUnit: 4, + onFocus: function() { cache.modal.editor.clearMarker(cache.modal.editor.errorLine); } + }); + + // todo: do this in a more foolproof way + // currently, we are just using an arbitrary value to determine when CodeMirror is finished setting up + // + setTimeout(function() { + cache.modal.box.find('input').focus() + + .change(function() { + if($(this).val() == "*") $(this).val(""); + }); + }, 20); + + cache.modal.editor.errorLine = 0; }; cache.modal.show(); } + // Called when Share button is clicked for a style function shareStyle(e) { var parent = $(e.target).parents('.custom-style'); @@ -288,82 +366,136 @@ function shareStyle(e) { } // Called when a style is updated (Update button is clicked) -function onUpdate() { - var url = cache.modal.box.find('div > b').html(); - var css = cache.modal.box.find('textarea').attr('value'); - saveStyle(url, css); -} - -// Displays the modal popup to add a new style -function addStyle() { - var html = "
URL:
"; - html += ""; - html += ""; - html += ""; - - initModal(html); - cache.modal.options.onOpen = function() { cache.modal.box.find('input').focus(); }; - cache.modal.show(); +// +function onSave(url) { + var css = cache.modal.editor.getValue(); + if (saveStyle(url, css)) { + cache.modal.hide(); + } } // Called when a new style is added (Add button is clicked) function onAdd() { var url = cache.modal.box.find('input').attr('value'); - var css = cache.modal.box.find('textarea').attr('value'); - if (css == "") + var css = cache.modal.editor.getValue(); + + if (css === "") return false; - if (saveStyle(url, css)) - createCustomStyleOption(url, styles[url]).appendTo($("#custom-styles")); + if (saveStyle(url, css, true)) { + cache.modal.hide(); + } } -// Saves a style. Called by onUpdate and onAdd -function saveStyle(url, css) { +// Saves a style and updates the UI. Called by onSave and onAdd +// +function saveStyle(url, css, add) { + // if css is empty. remove the style + if (css === "") + { + if (styles[url]) + { + delete styles[url]; + $('.custom-style-url:contains(' + url + ')').parent().remove(); + bg_window.saveStyles(styles); + bg_window.pushStyles(); + } + + return true; + } + + // else try to parse the style var parser = new CSSParser(); var sheet = parser.parse(css, false, true); - var retVal = false; if (sheet) { try { var rules = CSSUtils.getRulesFromParserObject(sheet); + + // syntax error! + // + if (rules['error']) + { + // todo: notify user of syntax error and highlight the error causing line + // + displaySyntaxError(css, rules['error']); + return false; + } + styles[url] = {}; styles[url]['_rules'] = rules; styles[url]['_social'] = {}; - retVal = true; + + bg_window.saveStyles(styles); + bg_window.pushStyles(); + + if (add) + createCustomStyleOption(url, styles[url]).appendTo($("#custom-styles")); + + return true; + } + + catch(e) { + // todo: show error here instead of just returning + // + return true; } - catch(e) {} } - // if css is empty. remove the style - else if (css === "" && styles[url]) { - delete styles[url]; - $('.custom-style-url:contains(' + url + ')').parent().remove(); + return true; +} + +function displayErrorMessage(msg) { + var $error = cache.modal.box.find('#parserError'); + + if ($error.length === 0) { + $error = $('
', { + id: 'parserError', + class: 'error' + }); + + cache.modal.box.append($error); } - bg_window.saveStyles(styles); - bg_window.pushStyles(); + $error.text(msg); +} - return retVal; +function displaySyntaxError(css, error) { + var start = css.indexOf(error.parsedCssText); + var end = start + error.parsedCssText.length; + //cache.modal.editor.setLineClass(error.currentLine-1, "CodeMirror-error"); + cache.modal.editor.setMarker(error.currentLine - 1, " %N%"); + cache.modal.editor.setCursor(error.currentLine - 1, 0); + cache.modal.editor.errorLine = error.currentLine - 1; + + displayErrorMessage('Syntax Error at Line ' + error.currentLine); } // Callback for edit in place for URLs function editURL(oldValue, newValue) { if (oldValue == newValue || newValue == "") return; + // going through a loop so that new entry is inserted at the same position // otherwise, on changing the url, new entry is inserted at the bottom + var newStyles = {}; - for (var url in styles) { - if (url == oldValue) { + + for (var url in styles) + { + if (url == oldValue) + { var rules = styles[oldValue]; newStyles[newValue] = rules; delete styles[oldValue]; } + else newStyles[url] = styles[url]; } + styles = newStyles; + bg_window.saveStyles(styles); } @@ -376,7 +508,12 @@ function export() { else css = ""; - var html = "
Copy and paste your custom styles into a text file:
"; + var html = " \ +
\ + \ +
"; initModal(html, { closeOnEsc: true, @@ -399,12 +536,16 @@ function copyToClipboard() { // Displays the modal popup for importing styles from JSON string function import() { - var html = "
Paste previously exported custom styles here. \ -
Note: Current custom styles for similar URLs will be replaced.
\ -
\ - \ - "; +
\ +
\ + \ + \ +
"; initModal(html, { closeOnEsc: true, @@ -424,19 +565,22 @@ function importCSS() { if (json && json != "") { - $(".custom-style").html(""); - try { var imported_styles = JSON.parse(json); styles = mergeStyles(imported_styles, styles); + bg_window.saveStyles(styles); } catch(e) { - console.log(e); + // show error. todo: show a more humanised message + displayErrorMessage("" + e); + return false; } fillCustomStyles(); + cache.modal.hide(); + return true; } } @@ -445,8 +589,7 @@ function importCSS() { // Initialize Sync UI based on value of the sync option function updateSyncUI() { $('#sync-button').html(options.sync ? "Disable Sync" : "Enable Sync"); - $('#sync-enabled-note').toggle(options.sync); - $('#sync-now').attr('disabled', !options.sync); + $('#sync-now').prop('disabled', !options.sync); } // Turn syncing on/off @@ -454,12 +597,23 @@ function updateSyncUI() { function toggleSyncing() { options.sync = !options.sync; bg_window.saveOption("sync", options.sync); + if (!options.sync) { bg_window.disableSync(); } + else { bg_window.enableSync(true); + // Update the UI + styles = bg_window.cache.styles; + + // todo: again, 200 is an arbitrary value to wait for bg_window to respond + // + setTimeout(function() { + fillCustomStyles(); + }, 200); } + updateSyncUI(); } @@ -471,6 +625,7 @@ function togglePageAction() { if (!options.showPageAction) { bg_window.hidePageActions(); } + else { bg_window.showPageActions(); } @@ -505,9 +660,11 @@ function initModal(html, options) { // Attach listener to search field for filtering styles function initFiltering() { - $("#style-search-field").bind('search', function(e){ + $("#style-search-field").bind('search', function(e) { filterStyles($(this).val()); - }).keyup(function(e){ + }) + + .keyup(function(e){ if(e.keyCode == 27){ $(this).val('') filterStyles(""); diff --git a/stylebot/js/page.js b/stylebot/js/page.js index 6c004971..7c46e970 100644 --- a/stylebot/js/page.js +++ b/stylebot/js/page.js @@ -1,17 +1,17 @@ /** * stylebot.page - * + * * Shows the editor for the entire page's CSS **/ stylebot.page = { - + isVisible: false, - + modal: null, - + timer: null, - + cache: { livePreview: false, originalCSS: null, @@ -68,13 +68,15 @@ table {\n\ border-spacing: 0 !important;\n\ }\n' }, - + create: function(options) { var html = "
Edit the CSS for " + stylebot.style.cache.url + ":
\ \
\ + \
\ \ "; - + this.modal = new ModalBox(html, options, function(){}); - + stylebot.page.cache.textarea = stylebot.page.modal.box.find('textarea').keyup(this.contentUpdated); - + var buttons = stylebot.page.modal.box.find('.stylebot-button'); - + var $livePreviewCheckbox = $(buttons.get(0)); - + $livePreviewCheckbox.click(this.toggleLivePreview) .tipsy({delayIn: 100, gravity:'sw'}); - + stylebot.chrome.getPreference("stylebot_page_live_preview", function(livePreview) { if (livePreview) { - $livePreviewCheckbox.attr('checked', 'checked'); + $livePreviewCheckbox.prop('checked', true); } - + stylebot.page.cache.livePreview = livePreview; }); - + $(buttons.get(1)).click(this.copyToClipboard) .tipsy({delayIn: 100, gravity:'sw'}); - + $(buttons.get(2)).click(this.save); $(buttons.get(3)).click(this.cancel); }, - + fill: function(content) { this.cache.textarea.attr('value', content); }, - + show: function(content, prevTarget) { if (!this.modal) { this.create({ @@ -130,7 +132,7 @@ table {\n\ height: $("#stylebot").height() - 30 + "px", bgOpacity: 0, parent: $("#stylebot"), - + onOpen: function() { var textarea = stylebot.page.cache.textarea.get(0); Utils.moveCursorToEnd(textarea); @@ -138,16 +140,16 @@ table {\n\ stylebot.style.saveState(); stylebot.page.cache.css = textarea.value; }, - + onClose: function() { stylebot.page.isVisible = false; prevTarget.focus(); $(window).unbind('resize', stylebot.page.onWindowResize); } - + }); } - + else { stylebot.page.modal.reset({ width: $("#stylebot").width() - 30 + "px", @@ -156,85 +158,90 @@ table {\n\ height: $("#stylebot").height() - 30 + "px", }); } - + this.cache.textarea.css('height', $("#stylebot").height() - 125 + "px"); - + this.fill(content); this.cache.originalCSS = content; this.isVisible = true; - + stylebot.page.modal.show(); - + $(window).bind('resize', this.onWindowResize); }, - + copyToClipboard: function() { var text = stylebot.page.cache.textarea.attr('value'); - stylebot.chrome.copyToClipboard(text); + if (text != undefined) + stylebot.chrome.copyToClipboard(text); }, - + applyResetCSS: function() { stylebot.page.cache.textarea.attr('value', stylebot.page.cache.resetCSS); - + if (stylebot.page.cache.livePreview) { stylebot.page.saveCSS(stylebot.page.cache.textarea.attr('value')); } }, - + toggleLivePreview: function() { if (stylebot.page.cache.livePreview) stylebot.page.cache.livePreview = false; - + else { stylebot.page.cache.livePreview = true; stylebot.page.contentUpdated(); } - + stylebot.chrome.savePreference("stylebot_page_live_preview", true); }, - + contentUpdated: function() { if (!stylebot.page.cache.livePreview) return; - + if (stylebot.page.timer) { clearTimeout(stylebot.page.timer); stylebot.page.timer = null; } - + stylebot.page.timer = setTimeout(function() { stylebot.page.saveCSS(stylebot.page.cache.textarea.attr('value')); }, 100); }, - + cancel: function(e) { stylebot.page.cancelChanges(); stylebot.style.clearLastState(); stylebot.page.modal.hide(); }, - + save: function(e) { stylebot.page.saveCSS(stylebot.page.cache.textarea.attr('value')); stylebot.widget.open(); stylebot.page.modal.hide(); }, - + cancelChanges: function() { stylebot.page.saveCSS(stylebot.page.cache.originalCSS); }, - + saveCSS: function(css) { - if (stylebot.page.cache.css != css) { + if (css == undefined) + return; + + if (stylebot.page.cache.css != css) + { stylebot.style.applyPageCSS(css); stylebot.style.refreshUndoState(); } - + else stylebot.style.clearLastState(); - + stylebot.page.cache.css = null; }, - + onWindowResize: function() { stylebot.page.modal.reset({ width: $("#stylebot").width() - 30 + "px", @@ -242,7 +249,7 @@ table {\n\ left: '0', height: $("#stylebot").height() - 30 + "px", }); - + stylebot.page.cache.textarea.css('height', $("#stylebot").height() - 125 + "px"); } } \ No newline at end of file diff --git a/stylebot/js/style.js b/stylebot/js/style.js index 906e8b42..6e9540d3 100644 --- a/stylebot/js/style.js +++ b/stylebot/js/style.js @@ -1,30 +1,30 @@ /** * stylebot.style - * + * * Generation and application of CSS rules **/ stylebot.style = { /* cache of custom CSS rules applied to elements on the current page - e.g.: + e.g.: rules = { - 'a': { + 'a': { 'color': '#fff', 'font-size': '12px' } } */ rules: {}, - + timer: null, - + parser: null, - + status: true, - + // the undo stack. size is limited to last 5 actions undoStack: [], - + cache: { // most recently selected elements' selector selector: null, @@ -33,7 +33,7 @@ stylebot.style = { url: document.domain, styleEl: null }, - + // initialize rules and url from temporary variables in apply-css.js initialize: function() { if (stylebotTempUrl) @@ -41,19 +41,19 @@ stylebot.style = { this.cache.url = stylebotTempUrl; delete stylebotTempUrl; } - + // if domain is empty, return url else if (!this.cache.url || this.cache.url == "") { this.cache.url = location.href; } - + if (stylebotTempRules) { this.rules = stylebotTempRules; delete stylebotTempRules; } }, - + // update current selector and selected elements fillCache: function(selector) { if (selector != this.cache.selector) @@ -62,13 +62,13 @@ stylebot.style = { try { this.cache.elements = $(selector + ":not(#stylebot, #stylebot *)"); } - + catch(e) { this.cache.elements = null; } } }, - + // applies property-value pair to currently selected elements as inline css, updates cache and saves the rule // called by basic mode apply: function(property, value) { @@ -86,18 +86,20 @@ stylebot.style = { } }, 0); }, - + // applies css to selected elements as inline css and calls saveRuleFromCSS // called by advanced mode applyCSS: function(css) { if (!stylebot.style.cache.selector) return true; - + // calculating timer duration based upon number of elements var duration; - if (stylebot.style.cache.elements) { + + if (stylebot.style.cache.elements) + { var noOfElements = stylebot.style.cache.elements.length; - + if (noOfElements >= 400) duration = 400; else if (noOfElements >= 200) @@ -105,85 +107,87 @@ stylebot.style = { else duration = 0; } - + else { duration = 0; } - + if (stylebot.style.updateCSSTimer) { clearTimeout(stylebot.style.updateCSSTimer); stylebot.style.updateCSSTimer = null; } - + stylebot.style.updateCSSTimer = setTimeout(function() { + stylebot.style.saveRuleFromCSS(css, stylebot.style.cache.selector); - - if (stylebot.style.cache.elements && stylebot.style.cache.elements.length != 0) { + + if (stylebot.style.cache.elements && stylebot.style.cache.elements.length != 0) + { var newCSS = CSSUtils.crunchCSSForSelector(stylebot.style.rules, stylebot.style.cache.selector, true); stylebot.style.updateInlineCSS(stylebot.style.cache.elements, newCSS); } - + else stylebot.style.updateStyleElement(stylebot.style.rules); - + }, duration); - + if (stylebot.style.timer) { clearTimeout(stylebot.style.timer); stylebot.style.timer = null; } - + stylebot.style.timer = setTimeout(function() { stylebot.style.save(); }, 1000); }, - + // called when CSS of the entire page is edited in a popup applyPageCSS: function(css) { if (css == "") this.rules = {}; - + else { if (!this.parser) this.parser = new CSSParser(); - + try { var sheet = this.parser.parse(css, false, true); var rules = CSSUtils.getRulesFromParserObject(sheet); this.rules = rules; } - + catch(e) {} } - + this.clearInlineCSS(this.cache.elements); this.updateStyleElement(this.rules); this.save(); }, - + // parses CSS into a rule, updates the cache and saves the rule saveRuleFromCSS: function(css, selector) { if (!selector) return true; - + // empty rule for selector delete this.rules[selector]; - + if (css != "") { - + if (!this.parser) this.parser = new CSSParser(); - - var sheet = this.parser.parse(selector + "{" + css + "}", false, false); + + var sheet = this.parser.parse(selector + "{" + css + "}", false, true); var generatedRule = CSSUtils.getRuleFromParserObject(sheet); - + // save rule to cache this.rules[selector] = generatedRule; } }, - - + + // add/update property-value pair in rules cache savePropertyToCache: function(selector, property, value) { // check if the selector already exists in the list @@ -196,49 +200,49 @@ stylebot.style = { if (rule[property] != undefined) { delete this.rules[selector][property]; - + // if no properties left, remove rule as well // TODO: Use something more elegant than this hack. var i = null; for (i in this.rules[selector]) { break; } - + if (!i) delete this.rules[selector]; } } - + else rule[property] = value; } - + else if (this.filter(property, value)) { this.rules[selector] = new Object(); this.rules[selector][property] = value; } }, - + // check if a property / value pair is valid for addition to rules cache filter: function(property, value) { if (value == "") return false; - + var sizeProperties = [ 'font-size', 'line-height', 'letter-spacing', 'letter-height', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', 'border-width', 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width' ]; - + if ($.inArray(property, sizeProperties) != -1 && parseFloat(value)) { if ($.inArray(value, WidgetUI.validSizeUnits) != -1) return false; } - + return true; }, - + // generate inline CSS for selector getInlineCSS: function(selector) { var rule = this.rules[selector]; - + if (rule != undefined) { var css = ""; @@ -246,117 +250,126 @@ stylebot.style = { if(property.indexOf("comment") != -1) continue; css += CSSUtils.getCSSDeclaration(property, rule[property], true); } - + return css; } - + return ""; }, - + // apply inline CSS to element(s) updateInlineCSS: function(el, newCustomCSS) { if (!el || el.length == 0) return false; - + el.each(function() { - var existingCSS = $.trim($(this).attr('style')); - var existingCustomCSS = $(this).data("stylebot-css"); + var $this = $(this); + + var existingCSS = $this.attr('style'); + existingCSS = existingCSS ? $.trim(existingCSS) : ""; + + var existingCustomCSS = $this.data("stylebotCSS"); + existingCustomCSS = existingCustomCSS ? $.trim(existingCustomCSS) : ""; + var newCSS; + // if stylebot css is being applied to the element for the first time if (!existingCustomCSS) { // if there is any existing inline CSS, append stylebot CSS to it if (existingCSS != undefined) { - if (existingCSS.length != 0 && existingCSS[existingCSS.length-1] != ";") + if (existingCSS.length != 0 && existingCSS[existingCSS.length - 1] != ";") newCSS = existingCSS + ";" + newCustomCSS; else newCSS = existingCSS + newCustomCSS; } + else newCSS = newCustomCSS; - $(this).attr({ - style: newCSS - }); } - + else { // replace existing stylebot CSS with updated stylebot CSS newCSS = existingCSS.replace(existingCustomCSS, newCustomCSS); - $(this).attr({ - style: newCSS - }); } - + + // update style + $this.attr('style', newCSS); + // update stylebot css data associated with element - $(this).data("stylebot-css", newCustomCSS); + $this.data("stylebotCSS", newCustomCSS); }); - + // update selection box setTimeout(function() { stylebot.selectionBox.highlight(stylebot.selectedElement); }, 0); }, - + // clear any custom inline CSS for element(s) clearInlineCSS: function(el) { if (!el) return false; - - el.each(function(){ - var existingCSS = $(this).attr('style'); - var existingCustomCSS = $(this).data("stylebot-css"); - if (existingCustomCSS && existingCSS != undefined) + + el.each(function() { + var $this = $(this); + + var existingCSS = $this.attr('style'); + var existingCustomCSS = $this.data("stylebotCSS"); + + if (existingCustomCSS != undefined && existingCSS != undefined) { var newCSS = existingCSS.replace(existingCustomCSS, ''); - $(this).attr({ - style: newCSS - }); + $this.attr('style', newCSS); + // clear stylebot css data associated with element - $(this).data("stylebot-css", null); + $this.data("stylebotCSS", null); } }); }, - + // clear all custom inline CSS resetInlineCSS: function() { for (var selector in stylebot.style.rules) stylebot.style.clearInlineCSS($(selector)); }, - + // remove rule for current selector from stylebot's