⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sidebar.js

📁 嵌入式无线路由系统openwrt的web配置工具
💻 JS
字号:
/*Class: FlashSYS.Sidebar  Desktop sidebar implementrationCopyright:  Copyright (C) 2008 OpenRB.comProperties:  isOpen - (boolean) sidebar state  container - (string or element) sidebar's container, defaults to 'pageWrapper'  contentPad - (integer) [content width] = [sidebar width] - [content padding]  openWidth - (integer) width of open sidebar  closedWidth - (integer) width of closed sidebarOptions:  minWidth - (integer) minimum width of sidebar  maxWidth - (integer) maximum width of sidebar  defaultWidth - (integer) default width of open sidebar  closedWidth - (integer) width of closed sidebar element*/FlashSYS.Sidebar = {  isOpen: false,  container: 'pageWrapper',  contentPad: 0,  openWidth: 0,  closedWidth: 0,  options: {    minWidth: 180,    maxWidth: 500,    defaultWidth: 260  },  /*  Function: init    Creates sidebar elements and injects into given container  Arguments:    container - (string or element) sidebar's container    options - (object) extra sidebar options  */  init: function(container, options) {    this.container = $((container || this.container));    this.options = $merge(this.options, options);    // wrapping element    this.wrapper = new Element('div', {      'id': 'Sidebar',      'class': 'Invisible'    }).inject(this.container);    // toggle element (open / close)    this.toggler = new Element('div', {      'id': 'SidebarToggle'    }).inject(this.wrapper);    // sizing handle    this.sizer = new Element('div', {      'id': 'SidebarSizer'    }).inject(this.wrapper);    // content goes inside this element    this.contentEl = new Element('div', {      'id': 'SidebarContent'    }).inject(this.wrapper);    this.wrapper.makeResizable({      modifiers: {x: 'width', y: false},      invert: true,      limit: {x: [this.options.minWidth, this.options.maxWidth]},      handle: this.sizer,      onStart: this.startResize.bind(this),      onComplete: this.endResize.bind(this)    });    // set default width    this.openWidth = this.options.defaultWidth;    // calculate closed width    this.closedWidth = this.toggler.getSize().x;    this.wrapper.setStyle('width', this.closedWidth);    // toggler events    this.toggler.addEvents({      'click': this.toggle.bind(this),      'mouseover': this.toggler.addClass.bind(this.toggler, 'SidebarToggleOver'),      'mouseout': this.toggler.removeClass.bind(this.toggler, 'SidebarToggleOver')    });    this.contentEl.set('text', 'There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.');    this.wrapper.removeClass('Invisible');  },  /*  Function: startResize    Fired when resize has been started  */  startResize: function() {    this.contentEl.setStyle('display', 'none');    this.options.openWidth = this.wrapper.getStyle('width');  },  /*  Function: endResize    Fired when resize has ended  */  endResize: function() {    this.contentEl.setStyle('display', 'block');    this.options.openWidth = this.wrapper.getStyle('width');  },  /*  Function: toggle    Open / closes sidebar  */  toggle: function() {    // open -> closed    if (this.isOpen) {      this.sizer.setStyle('display', 'none');      this.contentEl.setStyle('display', 'none');      this.wrapper.setStyle('width', this.closedWidth);      this.toggler.removeClass('SidebarToggleActive');    }    // closed -> open    else {      this.sizer.setStyle('display', 'block');      this.contentEl.setStyle('display', 'block');      this.wrapper.setStyle('width', this.openWidth);      this.toggler.addClass('SidebarToggleActive');    }    this.isOpen = !this.isOpen;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -