atcoder-sidemenu

AtCoderページの横に要素を乗せられるSidemenuを追加します。

当前为 2019-06-27 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/386715/712893/atcoder-sidemenu.js

  1. sidemenu = typeof(sidemenu) !== "undefined" ? sidemenu :
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 7);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ([
  89. /* 0 */
  90. /***/ (function(module, exports) {
  91.  
  92. module.exports = jQuery;
  93.  
  94. /***/ }),
  95. /* 1 */
  96. /***/ (function(module, exports) {
  97.  
  98. module.exports = "<div id=\"menu_wrap\">\n <div id=\"sidemenu\" class=\"container\"></div>\n <div id=\"sidemenu-key\" class=\"glyphicon glyphicon-menu-left\"></div>\n</div>";
  99.  
  100. /***/ }),
  101. /* 2 */
  102. /***/ (function(module, exports, __webpack_require__) {
  103.  
  104.  
  105. var content = __webpack_require__(3);
  106.  
  107. if(typeof content === 'string') content = [[module.i, content, '']];
  108.  
  109. var transform;
  110. var insertInto;
  111.  
  112.  
  113.  
  114. var options = {"hmr":true}
  115.  
  116. options.transform = transform
  117. options.insertInto = undefined;
  118.  
  119. var update = __webpack_require__(5)(content, options);
  120.  
  121. if(content.locals) module.exports = content.locals;
  122.  
  123. if(false) {}
  124.  
  125. /***/ }),
  126. /* 3 */
  127. /***/ (function(module, exports, __webpack_require__) {
  128.  
  129. exports = module.exports = __webpack_require__(4)(false);
  130. // Module
  131. exports.push([module.i, "@charset \"UTF-8\";\n#menu_wrap {\n display: block;\n position: fixed;\n top: 0;\n z-index: 20;\n width: 400px;\n right: -350px;\n transition: all 150ms 0ms ease;\n margin-top: 50px; }\n\n#sidemenu {\n background: #000;\n opacity: 0.85; }\n\n#sidemenu-key {\n border-radius: 5px 0px 0px 5px;\n background: #000;\n opacity: 0.85;\n color: #FFF;\n padding: 30px 0;\n cursor: pointer;\n margin-top: 100px;\n text-align: center; }\n\n#sidemenu {\n display: inline-block;\n width: 350px;\n float: right; }\n\n#sidemenu-key {\n display: inline-block;\n width: 50px;\n float: right; }\n\n.sidemenu-active {\n transform: translateX(-350px); }\n\n.sidemenu-txt {\n color: #DDD; }\n\n/*アコーディオンメニュー*/\n.menu-wrapper {\n border-bottom: 1px solid #FFF; }\n\n.menu-header {\n margin: 10px 20px 10px 20px;\n user-select: none; }\n\n.menu-box {\n overflow: hidden;\n transition: all 300ms 0s ease; }\n\n.menu-box-collapse {\n height: 0px !important; }\n .menu-box-collapse .menu-content {\n transform: translateY(-100%); }\n\n.menu-content {\n padding: 10px 20px 10px 20px;\n transition: all 300ms 0s ease; }\n\n.cnvtb-fixed {\n z-index: 19; }\n", ""]);
  132.  
  133.  
  134.  
  135. /***/ }),
  136. /* 4 */
  137. /***/ (function(module, exports, __webpack_require__) {
  138.  
  139. "use strict";
  140.  
  141.  
  142. /*
  143. MIT License http://www.opensource.org/licenses/mit-license.php
  144. Author Tobias Koppers @sokra
  145. */
  146. // css base code, injected by the css-loader
  147. module.exports = function (useSourceMap) {
  148. var list = []; // return the list of modules as css string
  149.  
  150. list.toString = function toString() {
  151. return this.map(function (item) {
  152. var content = cssWithMappingToString(item, useSourceMap);
  153.  
  154. if (item[2]) {
  155. return '@media ' + item[2] + '{' + content + '}';
  156. } else {
  157. return content;
  158. }
  159. }).join('');
  160. }; // import a list of modules into the list
  161.  
  162.  
  163. list.i = function (modules, mediaQuery) {
  164. if (typeof modules === 'string') {
  165. modules = [[null, modules, '']];
  166. }
  167.  
  168. var alreadyImportedModules = {};
  169.  
  170. for (var i = 0; i < this.length; i++) {
  171. var id = this[i][0];
  172.  
  173. if (id != null) {
  174. alreadyImportedModules[id] = true;
  175. }
  176. }
  177.  
  178. for (i = 0; i < modules.length; i++) {
  179. var item = modules[i]; // skip already imported module
  180. // this implementation is not 100% perfect for weird media query combinations
  181. // when a module is imported multiple times with different media queries.
  182. // I hope this will never occur (Hey this way we have smaller bundles)
  183.  
  184. if (item[0] == null || !alreadyImportedModules[item[0]]) {
  185. if (mediaQuery && !item[2]) {
  186. item[2] = mediaQuery;
  187. } else if (mediaQuery) {
  188. item[2] = '(' + item[2] + ') and (' + mediaQuery + ')';
  189. }
  190.  
  191. list.push(item);
  192. }
  193. }
  194. };
  195.  
  196. return list;
  197. };
  198.  
  199. function cssWithMappingToString(item, useSourceMap) {
  200. var content = item[1] || '';
  201. var cssMapping = item[3];
  202.  
  203. if (!cssMapping) {
  204. return content;
  205. }
  206.  
  207. if (useSourceMap && typeof btoa === 'function') {
  208. var sourceMapping = toComment(cssMapping);
  209. var sourceURLs = cssMapping.sources.map(function (source) {
  210. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';
  211. });
  212. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  213. }
  214.  
  215. return [content].join('\n');
  216. } // Adapted from convert-source-map (MIT)
  217.  
  218.  
  219. function toComment(sourceMap) {
  220. // eslint-disable-next-line no-undef
  221. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  222. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  223. return '/*# ' + data + ' */';
  224. }
  225.  
  226. /***/ }),
  227. /* 5 */
  228. /***/ (function(module, exports, __webpack_require__) {
  229.  
  230. /*
  231. MIT License http://www.opensource.org/licenses/mit-license.php
  232. Author Tobias Koppers @sokra
  233. */
  234.  
  235. var stylesInDom = {};
  236.  
  237. var memoize = function (fn) {
  238. var memo;
  239.  
  240. return function () {
  241. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  242. return memo;
  243. };
  244. };
  245.  
  246. var isOldIE = memoize(function () {
  247. // Test for IE <= 9 as proposed by Browserhacks
  248. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  249. // Tests for existence of standard globals is to allow style-loader
  250. // to operate correctly into non-standard environments
  251. // @see https://github.com/webpack-contrib/style-loader/issues/177
  252. return window && document && document.all && !window.atob;
  253. });
  254.  
  255. var getTarget = function (target, parent) {
  256. if (parent){
  257. return parent.querySelector(target);
  258. }
  259. return document.querySelector(target);
  260. };
  261.  
  262. var getElement = (function (fn) {
  263. var memo = {};
  264.  
  265. return function(target, parent) {
  266. // If passing function in options, then use it for resolve "head" element.
  267. // Useful for Shadow Root style i.e
  268. // {
  269. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  270. // }
  271. if (typeof target === 'function') {
  272. return target();
  273. }
  274. if (typeof memo[target] === "undefined") {
  275. var styleTarget = getTarget.call(this, target, parent);
  276. // Special case to return head of iframe instead of iframe itself
  277. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  278. try {
  279. // This will throw an exception if access to iframe is blocked
  280. // due to cross-origin restrictions
  281. styleTarget = styleTarget.contentDocument.head;
  282. } catch(e) {
  283. styleTarget = null;
  284. }
  285. }
  286. memo[target] = styleTarget;
  287. }
  288. return memo[target]
  289. };
  290. })();
  291.  
  292. var singleton = null;
  293. var singletonCounter = 0;
  294. var stylesInsertedAtTop = [];
  295.  
  296. var fixUrls = __webpack_require__(6);
  297.  
  298. module.exports = function(list, options) {
  299. if (typeof DEBUG !== "undefined" && DEBUG) {
  300. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  301. }
  302.  
  303. options = options || {};
  304.  
  305. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  306.  
  307. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  308. // tags it will allow on a page
  309. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  310.  
  311. // By default, add <style> tags to the <head> element
  312. if (!options.insertInto) options.insertInto = "head";
  313.  
  314. // By default, add <style> tags to the bottom of the target
  315. if (!options.insertAt) options.insertAt = "bottom";
  316.  
  317. var styles = listToStyles(list, options);
  318.  
  319. addStylesToDom(styles, options);
  320.  
  321. return function update (newList) {
  322. var mayRemove = [];
  323.  
  324. for (var i = 0; i < styles.length; i++) {
  325. var item = styles[i];
  326. var domStyle = stylesInDom[item.id];
  327.  
  328. domStyle.refs--;
  329. mayRemove.push(domStyle);
  330. }
  331.  
  332. if(newList) {
  333. var newStyles = listToStyles(newList, options);
  334. addStylesToDom(newStyles, options);
  335. }
  336.  
  337. for (var i = 0; i < mayRemove.length; i++) {
  338. var domStyle = mayRemove[i];
  339.  
  340. if(domStyle.refs === 0) {
  341. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  342.  
  343. delete stylesInDom[domStyle.id];
  344. }
  345. }
  346. };
  347. };
  348.  
  349. function addStylesToDom (styles, options) {
  350. for (var i = 0; i < styles.length; i++) {
  351. var item = styles[i];
  352. var domStyle = stylesInDom[item.id];
  353.  
  354. if(domStyle) {
  355. domStyle.refs++;
  356.  
  357. for(var j = 0; j < domStyle.parts.length; j++) {
  358. domStyle.parts[j](item.parts[j]);
  359. }
  360.  
  361. for(; j < item.parts.length; j++) {
  362. domStyle.parts.push(addStyle(item.parts[j], options));
  363. }
  364. } else {
  365. var parts = [];
  366.  
  367. for(var j = 0; j < item.parts.length; j++) {
  368. parts.push(addStyle(item.parts[j], options));
  369. }
  370.  
  371. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  372. }
  373. }
  374. }
  375.  
  376. function listToStyles (list, options) {
  377. var styles = [];
  378. var newStyles = {};
  379.  
  380. for (var i = 0; i < list.length; i++) {
  381. var item = list[i];
  382. var id = options.base ? item[0] + options.base : item[0];
  383. var css = item[1];
  384. var media = item[2];
  385. var sourceMap = item[3];
  386. var part = {css: css, media: media, sourceMap: sourceMap};
  387.  
  388. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  389. else newStyles[id].parts.push(part);
  390. }
  391.  
  392. return styles;
  393. }
  394.  
  395. function insertStyleElement (options, style) {
  396. var target = getElement(options.insertInto)
  397.  
  398. if (!target) {
  399. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  400. }
  401.  
  402. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  403.  
  404. if (options.insertAt === "top") {
  405. if (!lastStyleElementInsertedAtTop) {
  406. target.insertBefore(style, target.firstChild);
  407. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  408. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  409. } else {
  410. target.appendChild(style);
  411. }
  412. stylesInsertedAtTop.push(style);
  413. } else if (options.insertAt === "bottom") {
  414. target.appendChild(style);
  415. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  416. var nextSibling = getElement(options.insertAt.before, target);
  417. target.insertBefore(style, nextSibling);
  418. } else {
  419. throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
  420. }
  421. }
  422.  
  423. function removeStyleElement (style) {
  424. if (style.parentNode === null) return false;
  425. style.parentNode.removeChild(style);
  426.  
  427. var idx = stylesInsertedAtTop.indexOf(style);
  428. if(idx >= 0) {
  429. stylesInsertedAtTop.splice(idx, 1);
  430. }
  431. }
  432.  
  433. function createStyleElement (options) {
  434. var style = document.createElement("style");
  435.  
  436. if(options.attrs.type === undefined) {
  437. options.attrs.type = "text/css";
  438. }
  439.  
  440. if(options.attrs.nonce === undefined) {
  441. var nonce = getNonce();
  442. if (nonce) {
  443. options.attrs.nonce = nonce;
  444. }
  445. }
  446.  
  447. addAttrs(style, options.attrs);
  448. insertStyleElement(options, style);
  449.  
  450. return style;
  451. }
  452.  
  453. function createLinkElement (options) {
  454. var link = document.createElement("link");
  455.  
  456. if(options.attrs.type === undefined) {
  457. options.attrs.type = "text/css";
  458. }
  459. options.attrs.rel = "stylesheet";
  460.  
  461. addAttrs(link, options.attrs);
  462. insertStyleElement(options, link);
  463.  
  464. return link;
  465. }
  466.  
  467. function addAttrs (el, attrs) {
  468. Object.keys(attrs).forEach(function (key) {
  469. el.setAttribute(key, attrs[key]);
  470. });
  471. }
  472.  
  473. function getNonce() {
  474. if (false) {}
  475.  
  476. return __webpack_require__.nc;
  477. }
  478.  
  479. function addStyle (obj, options) {
  480. var style, update, remove, result;
  481.  
  482. // If a transform function was defined, run it on the css
  483. if (options.transform && obj.css) {
  484. result = typeof options.transform === 'function'
  485. ? options.transform(obj.css)
  486. : options.transform.default(obj.css);
  487.  
  488. if (result) {
  489. // If transform returns a value, use that instead of the original css.
  490. // This allows running runtime transformations on the css.
  491. obj.css = result;
  492. } else {
  493. // If the transform function returns a falsy value, don't add this css.
  494. // This allows conditional loading of css
  495. return function() {
  496. // noop
  497. };
  498. }
  499. }
  500.  
  501. if (options.singleton) {
  502. var styleIndex = singletonCounter++;
  503.  
  504. style = singleton || (singleton = createStyleElement(options));
  505.  
  506. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  507. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  508.  
  509. } else if (
  510. obj.sourceMap &&
  511. typeof URL === "function" &&
  512. typeof URL.createObjectURL === "function" &&
  513. typeof URL.revokeObjectURL === "function" &&
  514. typeof Blob === "function" &&
  515. typeof btoa === "function"
  516. ) {
  517. style = createLinkElement(options);
  518. update = updateLink.bind(null, style, options);
  519. remove = function () {
  520. removeStyleElement(style);
  521.  
  522. if(style.href) URL.revokeObjectURL(style.href);
  523. };
  524. } else {
  525. style = createStyleElement(options);
  526. update = applyToTag.bind(null, style);
  527. remove = function () {
  528. removeStyleElement(style);
  529. };
  530. }
  531.  
  532. update(obj);
  533.  
  534. return function updateStyle (newObj) {
  535. if (newObj) {
  536. if (
  537. newObj.css === obj.css &&
  538. newObj.media === obj.media &&
  539. newObj.sourceMap === obj.sourceMap
  540. ) {
  541. return;
  542. }
  543.  
  544. update(obj = newObj);
  545. } else {
  546. remove();
  547. }
  548. };
  549. }
  550.  
  551. var replaceText = (function () {
  552. var textStore = [];
  553.  
  554. return function (index, replacement) {
  555. textStore[index] = replacement;
  556.  
  557. return textStore.filter(Boolean).join('\n');
  558. };
  559. })();
  560.  
  561. function applyToSingletonTag (style, index, remove, obj) {
  562. var css = remove ? "" : obj.css;
  563.  
  564. if (style.styleSheet) {
  565. style.styleSheet.cssText = replaceText(index, css);
  566. } else {
  567. var cssNode = document.createTextNode(css);
  568. var childNodes = style.childNodes;
  569.  
  570. if (childNodes[index]) style.removeChild(childNodes[index]);
  571.  
  572. if (childNodes.length) {
  573. style.insertBefore(cssNode, childNodes[index]);
  574. } else {
  575. style.appendChild(cssNode);
  576. }
  577. }
  578. }
  579.  
  580. function applyToTag (style, obj) {
  581. var css = obj.css;
  582. var media = obj.media;
  583.  
  584. if(media) {
  585. style.setAttribute("media", media)
  586. }
  587.  
  588. if(style.styleSheet) {
  589. style.styleSheet.cssText = css;
  590. } else {
  591. while(style.firstChild) {
  592. style.removeChild(style.firstChild);
  593. }
  594.  
  595. style.appendChild(document.createTextNode(css));
  596. }
  597. }
  598.  
  599. function updateLink (link, options, obj) {
  600. var css = obj.css;
  601. var sourceMap = obj.sourceMap;
  602.  
  603. /*
  604. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  605. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  606. on by default. Otherwise default to the convertToAbsoluteUrls option
  607. directly
  608. */
  609. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  610.  
  611. if (options.convertToAbsoluteUrls || autoFixUrls) {
  612. css = fixUrls(css);
  613. }
  614.  
  615. if (sourceMap) {
  616. // http://stackoverflow.com/a/26603875
  617. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  618. }
  619.  
  620. var blob = new Blob([css], { type: "text/css" });
  621.  
  622. var oldSrc = link.href;
  623.  
  624. link.href = URL.createObjectURL(blob);
  625.  
  626. if(oldSrc) URL.revokeObjectURL(oldSrc);
  627. }
  628.  
  629.  
  630. /***/ }),
  631. /* 6 */
  632. /***/ (function(module, exports) {
  633.  
  634.  
  635. /**
  636. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  637. * embed the css on the page. This breaks all relative urls because now they are relative to a
  638. * bundle instead of the current page.
  639. *
  640. * One solution is to only use full urls, but that may be impossible.
  641. *
  642. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  643. *
  644. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  645. *
  646. */
  647.  
  648. module.exports = function (css) {
  649. // get current location
  650. var location = typeof window !== "undefined" && window.location;
  651.  
  652. if (!location) {
  653. throw new Error("fixUrls requires window.location");
  654. }
  655.  
  656. // blank or null?
  657. if (!css || typeof css !== "string") {
  658. return css;
  659. }
  660.  
  661. var baseUrl = location.protocol + "//" + location.host;
  662. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  663.  
  664. // convert each url(...)
  665. /*
  666. This regular expression is just a way to recursively match brackets within
  667. a string.
  668. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  669. ( = Start a capturing group
  670. (?: = Start a non-capturing group
  671. [^)(] = Match anything that isn't a parentheses
  672. | = OR
  673. \( = Match a start parentheses
  674. (?: = Start another non-capturing groups
  675. [^)(]+ = Match anything that isn't a parentheses
  676. | = OR
  677. \( = Match a start parentheses
  678. [^)(]* = Match anything that isn't a parentheses
  679. \) = Match a end parentheses
  680. ) = End Group
  681. *\) = Match anything and then a close parens
  682. ) = Close non-capturing group
  683. * = Match anything
  684. ) = Close capturing group
  685. \) = Match a close parens
  686. /gi = Get all matches, not the first. Be case insensitive.
  687. */
  688. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  689. // strip quotes (if they exist)
  690. var unquotedOrigUrl = origUrl
  691. .trim()
  692. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  693. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  694.  
  695. // already a full url? no change
  696. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  697. return fullMatch;
  698. }
  699.  
  700. // convert the url to a full url
  701. var newUrl;
  702.  
  703. if (unquotedOrigUrl.indexOf("//") === 0) {
  704. //TODO: should we add protocol?
  705. newUrl = unquotedOrigUrl;
  706. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  707. // path should be relative to the base url
  708. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  709. } else {
  710. // path should be relative to current directory
  711. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  712. }
  713.  
  714. // send back the fixed url(...)
  715. return "url(" + JSON.stringify(newUrl) + ")";
  716. });
  717.  
  718. // send back the fixed css
  719. return fixedCss;
  720. };
  721.  
  722.  
  723. /***/ }),
  724. /* 7 */
  725. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  726.  
  727. "use strict";
  728. __webpack_require__.r(__webpack_exports__);
  729.  
  730. // EXTERNAL MODULE: ./src/libs/sidemenu.scss
  731. var sidemenu = __webpack_require__(2);
  732.  
  733. // EXTERNAL MODULE: external "jQuery"
  734. var external_jQuery_ = __webpack_require__(0);
  735.  
  736. // EXTERNAL MODULE: ./src/libs/sidemenu.html
  737. var libs_sidemenu = __webpack_require__(1);
  738. var libs_sidemenu_default = /*#__PURE__*/__webpack_require__.n(libs_sidemenu);
  739.  
  740. // CONCATENATED MODULE: ./src/libs/element.js
  741. /**
  742. * サイドメニューに追加される要素のクラス
  743. */
  744. class SideMenuElement {
  745.  
  746. /**
  747. * オブジェクト生成用のコンストラクタ
  748. * @param {string} [id] 要素のコンテナに付加されるIDです。
  749. * @param {string} [title] 要素に表示されるタイトルです。
  750. * @param {RegExp} [match] 表示されるページを指定するための正規表現です。
  751. * @param {string} [document] 要素のHTMLです。
  752. * @param {Function} [afterAppend] 要素が追加された後に実行される処理用の関数です。
  753. */
  754. constructor(id, title, match, document, afterAppend) {
  755. this.id = id;
  756. this.title = title;
  757. this.match = match;
  758. this.document = document;
  759. this.afterAppend = afterAppend;
  760. }
  761.  
  762. /**
  763. * URLのページで要素を表示するべきか
  764. * @param {string} [url] ページのURL
  765. */
  766. shouldDisplayed(url) {
  767. return this.match.test(url);
  768. }
  769.  
  770. /**
  771. * 要素のHTMLを取得
  772. */
  773. GetHTML() {
  774. return `<div class="menu-wrapper">
  775. <div class="menu-header">
  776. <h4 class="sidemenu-txt">${this.title}<span class="glyphicon glyphicon-menu-up" style="float: right"></span></h4>
  777. </div>
  778. <div class="menu-box"><div class="menu-content" id="${this.id}">${this.document}</div></div>
  779. </div>`;
  780. }
  781. }
  782.  
  783. // CONCATENATED MODULE: ./src/libs/sidemenu.js
  784.  
  785.  
  786.  
  787.  
  788.  
  789. /**
  790. * サイドメニューのクラス
  791. */
  792. class sidemenu_SideMenu {
  793. constructor() {
  794. this.Generate();
  795. }
  796.  
  797. /**
  798. * サイドメニューを生成する
  799. */
  800. Generate() {
  801. external_jQuery_('#main-div').append(libs_sidemenu_default.a);
  802. resizeSidemenuHeight();
  803. external_jQuery_('#sidemenu-key').click(function () {
  804. external_jQuery_('#sidemenu-key').toggleClass('glyphicon-menu-left glyphicon-menu-right');
  805. external_jQuery_('#menu_wrap').toggleClass('sidemenu-active');
  806. });
  807. external_jQuery_(window).resize(resizeSidemenuHeight);
  808. external_jQuery_('#sidemenu').on('click', '.menu-header', (event) => {
  809. external_jQuery_(event.target).parents('.menu-wrapper').find('.menu-box').toggleClass('menu-box-collapse');
  810. external_jQuery_(event.target).find('.glyphicon').toggleClass('glyphicon-menu-down glyphicon-menu-up');
  811. });
  812.  
  813. function resizeSidemenuHeight() {
  814. external_jQuery_('#sidemenu').height(external_jQuery_(window).height());
  815. }
  816. }
  817.  
  818. /**
  819. * サイドメニューに要素を追加する
  820. * @param {SideMenuElement} [element] 追加する要素
  821. */
  822. addElement(element) {
  823. if (!element.shouldDisplayed(document.location.href)) return;
  824. const elementHtml = external_jQuery_(element.GetHTML());
  825. external_jQuery_('#sidemenu').append(elementHtml);
  826. elementHtml.ready(() => {
  827. const content = external_jQuery_('.menu-content', elementHtml);
  828. content.parents('.menu-box').css('height', content.outerHeight(true));
  829. element.afterAppend();
  830. });
  831. }
  832. }
  833.  
  834. // CONCATENATED MODULE: ./src/main.js
  835. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sidemenu", function() { return main_sidemenu; });
  836. /* concated harmony reexport SideMenuElement */__webpack_require__.d(__webpack_exports__, "SideMenuElement", function() { return SideMenuElement; });
  837.  
  838.  
  839.  
  840. /**
  841. * サイドメニューのシングルトン
  842. */
  843. const main_sidemenu = new sidemenu_SideMenu();
  844.  
  845.  
  846.  
  847. /***/ })
  848. /******/ ]);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址