├── README.md ├── WEB-INF ├── html │ └── test.html ├── lib │ ├── spring-aop-4.1.1.RELEASE.jar │ ├── spring-aspects-4.1.1.RELEASE.jar │ ├── spring-beans-4.1.1.RELEASE.jar │ ├── spring-context-4.1.1.RELEASE.jar │ ├── spring-context-support-4.1.1.RELEASE.jar │ ├── spring-core-4.1.1.RELEASE.jar │ ├── spring-expression-4.1.1.RELEASE.jar │ ├── spring-framework-bom-4.0.6.RELEASE.jar │ ├── spring-instrument-4.1.1.RELEASE.jar │ ├── spring-instrument-tomcat-4.1.1.RELEASE.jar │ ├── spring-jdbc-4.1.1.RELEASE.jar │ ├── spring-jms-4.1.1.RELEASE.jar │ ├── spring-messaging-4.1.1.RELEASE.jar │ ├── spring-orm-4.1.1.RELEASE.jar │ ├── spring-oxm-4.1.1.RELEASE.jar │ ├── spring-test-4.1.1.RELEASE.jar │ ├── spring-tx-4.1.1.RELEASE.jar │ ├── spring-web-4.1.1.RELEASE.jar │ ├── spring-webmvc-4.1.1.RELEASE.jar │ ├── spring-webmvc-portlet-4.1.1.RELEASE.jar │ └── spring-websocket-4.1.1.RELEASE.jar ├── problems.txt ├── test.html └── web.xml ├── bootstrap ├── config.json ├── css │ ├── bootstrap-docs.css │ ├── bootstrap-responsive.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ ├── buttons.css │ ├── prettify.css │ └── theme.css ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png └── js │ ├── affix.js │ ├── alert.js │ ├── application.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── button.js │ ├── carousel.js │ ├── collapse.js │ ├── customizer.js │ ├── dropdown.js │ ├── filesaver.js │ ├── google-code-prettify │ └── prettify.js │ ├── holder.js │ ├── ie8-responsive-file-warning.js │ ├── jszip.js │ ├── less.js │ ├── modal.js │ ├── popover.js │ ├── raw-files.js │ ├── scrollspy.js │ ├── tab.js │ ├── tooltip.js │ ├── transition.js │ └── uglify.js ├── css ├── graph.css ├── graph_old.css ├── index.css ├── sort.css ├── string.css └── tree.css ├── favicon.ico ├── graph ├── dijkstra.html ├── floyd.html ├── graphBFSTraverse.html ├── graphDFSTraverse.html ├── kruskal.html └── prim.html ├── image ├── arrow_black_right.png ├── arrow_white_right.png ├── logo.png ├── logo_old.png ├── main_page.png ├── 二叉树.jpg ├── 图.jpg ├── 字符串.jpg ├── 排序.jpg └── 线性表.jpg ├── index.html ├── index.js ├── jquery.js ├── js ├── AVLTree.js ├── Algorithm.js ├── AnimatedCircle.js ├── AnimatedHighlightCircle.js ├── AnimatedHighlightRectangle.js ├── AnimatedLabel.js ├── AnimatedLine.js ├── AnimatedObject.js ├── AnimatedPointer.js ├── AnimatedRectangle.js ├── AnimationManager.js ├── BFS.js ├── BT2T.js ├── BinarySearch.js ├── BinarySearchTree.js ├── CompareSort.js ├── CompareSort_old.js ├── DFS.js ├── Dijkstra.js ├── Factorial.js ├── Floyd.js ├── Forest.js ├── Graph.js ├── Heap.js ├── HeapSort.js ├── Huffman.js ├── Kruskal.js ├── LinearSearch.js ├── LinkedList.js ├── LinkedQueue.js ├── ObjectManager.js ├── OrderList.js ├── PatternMatch.js ├── Prim.js ├── Queue.js ├── RadixSort.js ├── Search.js ├── SingleAnimation.js ├── Slider.js ├── Stack.js ├── StateBox.js └── ThrdBTree.js ├── list ├── factorial.html ├── linearList.html ├── linkedQueue.html ├── queueList.html ├── singleList.html └── stackList.html ├── page └── test.html ├── sort ├── compareSort.html ├── heapSort.html └── radixSort.html ├── string ├── patternMatch.html ├── search.html └── stringMatch.html └── tree ├── BST.html ├── BT2T.html ├── HuffmanTree.html ├── avlTree.html ├── heap.html └── thrdBtree.html /README.md: -------------------------------------------------------------------------------- 1 | # 大连理工大学软件学院数据结构算法可视化演示平台 2 | 3 | --- 4 | 5 | ## 项目主页如下图: 6 | 7 | 8 | 9 | ## 项目链接如下: 10 | 11 | [数据结构算法演示平台](http://kinlog.github.io/visualgo/index.html) 12 | 13 | ## 演示功能算法 14 | 15 | - 线性表 16 | + 顺序表 17 | + 单链表 18 | + 栈 19 | + 队列 20 | + 阶乘 21 | + 链式队列 22 | - 树 23 | + 二叉树 24 | + 堆 25 | + 霍夫曼树 26 | + AVL树 27 | + 二叉树转森林 28 | + 线索树 29 | - 图 30 | + DFS广度遍历 31 | + BFD深度遍历 32 | + Prim最小生成树 33 | + Kruskal最小生成树 34 | + Dijkstra最短路径 35 | - 排序 36 | + 比较排序 37 | + 基数排序 38 | + 堆排序 39 | - 字符串 40 | + 模式匹配 41 | + 查找 42 | -------------------------------------------------------------------------------- /WEB-INF/html/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | 9 |

Hello, this is a test page

10 | 11 | 12 | -------------------------------------------------------------------------------- /WEB-INF/lib/spring-aop-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-aop-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-aspects-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-aspects-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-beans-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-beans-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-context-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-context-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-context-support-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-context-support-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-core-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-core-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-expression-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-expression-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-framework-bom-4.0.6.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-framework-bom-4.0.6.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-instrument-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-instrument-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-instrument-tomcat-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-instrument-tomcat-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-jdbc-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-jdbc-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-jms-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-jms-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-messaging-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-messaging-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-orm-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-orm-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-oxm-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-oxm-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-test-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-test-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-tx-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-tx-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-web-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-web-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-webmvc-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-webmvc-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-webmvc-portlet-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-webmvc-portlet-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/lib/spring-websocket-4.1.1.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/WEB-INF/lib/spring-websocket-4.1.1.RELEASE.jar -------------------------------------------------------------------------------- /WEB-INF/problems.txt: -------------------------------------------------------------------------------- 1 | #1. avl树存在错误,测试用例:10-20-9 2 | #2. BST问题同1 3 | 3. Search.js 存在问题,待修复 4 | 4. 张鹏部分:还有个问题就是输入数组边界,点击设置的时候应该会在右上角显示大小,并且创建空的矩形,但是这步的动画显示会延迟到输入数组元素部分。我检查过index.js和search.js两个文件,发现在初始化数组大小的时候的确调用了initMAxSize函数,但是会出现这个问题,暂时搞不懂了。。。。 5 | -------------------------------------------------------------------------------- /WEB-INF/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | 9 |

Hello, this is a test page

10 | 11 | 12 | -------------------------------------------------------------------------------- /WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ssdutAlgo 4 | 5 | index.html 6 | 7 | -------------------------------------------------------------------------------- /bootstrap/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "vars": {}, 3 | "css": [ 4 | "print.less", 5 | "type.less", 6 | "code.less", 7 | "grid.less", 8 | "tables.less", 9 | "forms.less", 10 | "buttons.less", 11 | "glyphicons.less", 12 | "button-groups.less", 13 | "input-groups.less", 14 | "navs.less", 15 | "navbar.less", 16 | "breadcrumbs.less", 17 | "pagination.less", 18 | "pager.less", 19 | "labels.less", 20 | "badges.less", 21 | "jumbotron.less", 22 | "thumbnails.less", 23 | "alerts.less", 24 | "progress-bars.less", 25 | "media.less", 26 | "list-group.less", 27 | "panels.less", 28 | "wells.less", 29 | "close.less", 30 | "component-animations.less", 31 | "dropdowns.less", 32 | "tooltip.less", 33 | "popovers.less", 34 | "modals.less", 35 | "carousel.less", 36 | "utilities.less", 37 | "responsive-utilities.less" 38 | ], 39 | "js": [ 40 | "alert.js", 41 | "button.js", 42 | "carousel.js", 43 | "dropdown.js", 44 | "modal.js", 45 | "tooltip.js", 46 | "popover.js", 47 | "tab.js", 48 | "affix.js", 49 | "collapse.js", 50 | "scrollspy.js", 51 | "transition.js" 52 | ] 53 | } -------------------------------------------------------------------------------- /bootstrap/css/prettify.css: -------------------------------------------------------------------------------- 1 | .com { color: #93a1a1; } 2 | .lit { color: #195f91; } 3 | .pun, .opn, .clo { color: #93a1a1; } 4 | .fun { color: #dc322f; } 5 | .str, .atv { color: #D14; } 6 | .kwd, .prettyprint .tag { color: #1e347b; } 7 | .typ, .atn, .dec, .var { color: teal; } 8 | .pln { color: #48484c; } 9 | 10 | .prettyprint { 11 | padding: 8px; 12 | background-color: #f7f7f9; 13 | border: 1px solid #e1e1e8; 14 | } 15 | .prettyprint.linenums { 16 | -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 17 | -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 18 | box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 19 | } 20 | 21 | /* Specify class=linenums on a pre to get line numbering */ 22 | ol.linenums { 23 | margin: 0 0 0 33px; /* IE indents via margin-left */ 24 | } 25 | ol.linenums li { 26 | padding-left: 12px; 27 | color: #bebec5; 28 | line-height: 20px; 29 | text-shadow: 0 1px 0 #fff; 30 | } -------------------------------------------------------------------------------- /bootstrap/css/theme.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 70px; 3 | padding-bottom: 30px; 4 | } 5 | 6 | .theme-dropdown .dropdown-menu { 7 | display: block; 8 | position: static; 9 | margin-bottom: 20px; 10 | } 11 | 12 | .theme-showcase > p > .btn { 13 | margin: 5px 0; 14 | } -------------------------------------------------------------------------------- /bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /bootstrap/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/bootstrap/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /bootstrap/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kinlog/visualgo/6de698a608295cd48981cf0272896abcd03d818c/bootstrap/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /bootstrap/js/affix.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: affix.js v3.0.0 3 | * http://getbootstrap.com/javascript/#affix 4 | * ======================================================================== 5 | * Copyright 2013 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ======================================================================== */ 19 | 20 | 21 | +function ($) { "use strict"; 22 | 23 | // AFFIX CLASS DEFINITION 24 | // ====================== 25 | 26 | var Affix = function (element, options) { 27 | this.options = $.extend({}, Affix.DEFAULTS, options) 28 | this.$window = $(window) 29 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 30 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) 31 | 32 | this.$element = $(element) 33 | this.affixed = 34 | this.unpin = null 35 | 36 | this.checkPosition() 37 | } 38 | 39 | Affix.RESET = 'affix affix-top affix-bottom' 40 | 41 | Affix.DEFAULTS = { 42 | offset: 0 43 | } 44 | 45 | Affix.prototype.checkPositionWithEventLoop = function () { 46 | setTimeout($.proxy(this.checkPosition, this), 1) 47 | } 48 | 49 | Affix.prototype.checkPosition = function () { 50 | if (!this.$element.is(':visible')) return 51 | 52 | var scrollHeight = $(document).height() 53 | var scrollTop = this.$window.scrollTop() 54 | var position = this.$element.offset() 55 | var offset = this.options.offset 56 | var offsetTop = offset.top 57 | var offsetBottom = offset.bottom 58 | 59 | if (typeof offset != 'object') offsetBottom = offsetTop = offset 60 | if (typeof offsetTop == 'function') offsetTop = offset.top() 61 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() 62 | 63 | var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : 64 | offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : 65 | offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false 66 | 67 | if (this.affixed === affix) return 68 | if (this.unpin) this.$element.css('top', '') 69 | 70 | this.affixed = affix 71 | this.unpin = affix == 'bottom' ? position.top - scrollTop : null 72 | 73 | this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : '')) 74 | 75 | if (affix == 'bottom') { 76 | this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() }) 77 | } 78 | } 79 | 80 | 81 | // AFFIX PLUGIN DEFINITION 82 | // ======================= 83 | 84 | var old = $.fn.affix 85 | 86 | $.fn.affix = function (option) { 87 | return this.each(function () { 88 | var $this = $(this) 89 | var data = $this.data('bs.affix') 90 | var options = typeof option == 'object' && option 91 | 92 | if (!data) $this.data('bs.affix', (data = new Affix(this, options))) 93 | if (typeof option == 'string') data[option]() 94 | }) 95 | } 96 | 97 | $.fn.affix.Constructor = Affix 98 | 99 | 100 | // AFFIX NO CONFLICT 101 | // ================= 102 | 103 | $.fn.affix.noConflict = function () { 104 | $.fn.affix = old 105 | return this 106 | } 107 | 108 | 109 | // AFFIX DATA-API 110 | // ============== 111 | 112 | $(window).on('load', function () { 113 | $('[data-spy="affix"]').each(function () { 114 | var $spy = $(this) 115 | var data = $spy.data() 116 | 117 | data.offset = data.offset || {} 118 | 119 | if (data.offsetBottom) data.offset.bottom = data.offsetBottom 120 | if (data.offsetTop) data.offset.top = data.offsetTop 121 | 122 | $spy.affix(data) 123 | }) 124 | }) 125 | 126 | }(window.jQuery); 127 | -------------------------------------------------------------------------------- /bootstrap/js/alert.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: alert.js v3.0.0 3 | * http://getbootstrap.com/javascript/#alerts 4 | * ======================================================================== 5 | * Copyright 2013 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ======================================================================== */ 19 | 20 | 21 | +function ($) { "use strict"; 22 | 23 | // ALERT CLASS DEFINITION 24 | // ====================== 25 | 26 | var dismiss = '[data-dismiss="alert"]' 27 | var Alert = function (el) { 28 | $(el).on('click', dismiss, this.close) 29 | } 30 | 31 | Alert.prototype.close = function (e) { 32 | var $this = $(this) 33 | var selector = $this.attr('data-target') 34 | 35 | if (!selector) { 36 | selector = $this.attr('href') 37 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 38 | } 39 | 40 | var $parent = $(selector) 41 | 42 | if (e) e.preventDefault() 43 | 44 | if (!$parent.length) { 45 | $parent = $this.hasClass('alert') ? $this : $this.parent() 46 | } 47 | 48 | $parent.trigger(e = $.Event('close.bs.alert')) 49 | 50 | if (e.isDefaultPrevented()) return 51 | 52 | $parent.removeClass('in') 53 | 54 | function removeElement() { 55 | $parent.trigger('closed.bs.alert').remove() 56 | } 57 | 58 | $.support.transition && $parent.hasClass('fade') ? 59 | $parent 60 | .one($.support.transition.end, removeElement) 61 | .emulateTransitionEnd(150) : 62 | removeElement() 63 | } 64 | 65 | 66 | // ALERT PLUGIN DEFINITION 67 | // ======================= 68 | 69 | var old = $.fn.alert 70 | 71 | $.fn.alert = function (option) { 72 | return this.each(function () { 73 | var $this = $(this) 74 | var data = $this.data('bs.alert') 75 | 76 | if (!data) $this.data('bs.alert', (data = new Alert(this))) 77 | if (typeof option == 'string') data[option].call($this) 78 | }) 79 | } 80 | 81 | $.fn.alert.Constructor = Alert 82 | 83 | 84 | // ALERT NO CONFLICT 85 | // ================= 86 | 87 | $.fn.alert.noConflict = function () { 88 | $.fn.alert = old 89 | return this 90 | } 91 | 92 | 93 | // ALERT DATA-API 94 | // ============== 95 | 96 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 97 | 98 | }(window.jQuery); 99 | -------------------------------------------------------------------------------- /bootstrap/js/application.js: -------------------------------------------------------------------------------- 1 | // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT 2 | // IT'S ALL JUST JUNK FOR OUR DOCS! 3 | // ++++++++++++++++++++++++++++++++++++++++++ 4 | 5 | !function ($) { 6 | 7 | $(function(){ 8 | 9 | var $window = $(window) 10 | 11 | // Disable certain links in docs 12 | $('section [href^=#]').click(function (e) { 13 | e.preventDefault() 14 | }) 15 | 16 | // side bar 17 | setTimeout(function () { 18 | $('.bs-docs-sidenav').affix({ 19 | offset: { 20 | top: function () { return $window.width() <= 980 ? 290 : 210 } 21 | , bottom: 270 22 | } 23 | }) 24 | }, 100) 25 | 26 | // make code pretty 27 | window.prettyPrint && prettyPrint() 28 | 29 | // add-ons 30 | $('.add-on :checkbox').on('click', function () { 31 | var $this = $(this) 32 | , method = $this.attr('checked') ? 'addClass' : 'removeClass' 33 | $(this).parents('.add-on')[method]('active') 34 | }) 35 | 36 | // add tipsies to grid for scaffolding 37 | if ($('#gridSystem').length) { 38 | $('#gridSystem').tooltip({ 39 | selector: '.show-grid > [class*="span"]' 40 | , title: function () { return $(this).width() + 'px' } 41 | }) 42 | } 43 | 44 | // tooltip demo 45 | $('.tooltip-demo').tooltip({ 46 | selector: "a[data-toggle=tooltip]" 47 | }) 48 | 49 | $('.tooltip-test').tooltip() 50 | $('.popover-test').popover() 51 | 52 | // popover demo 53 | $("a[data-toggle=popover]") 54 | .popover() 55 | .click(function(e) { 56 | e.preventDefault() 57 | }) 58 | 59 | // button state demo 60 | $('#fat-btn') 61 | .click(function () { 62 | var btn = $(this) 63 | btn.button('loading') 64 | setTimeout(function () { 65 | btn.button('reset') 66 | }, 3000) 67 | }) 68 | 69 | // carousel demo 70 | $('#myCarousel').carousel() 71 | 72 | // javascript build logic 73 | var inputsComponent = $("#components.download input") 74 | , inputsPlugin = $("#plugins.download input") 75 | , inputsVariables = $("#variables.download input") 76 | 77 | // toggle all plugin checkboxes 78 | $('#components.download .toggle-all').on('click', function (e) { 79 | e.preventDefault() 80 | inputsComponent.attr('checked', !inputsComponent.is(':checked')) 81 | }) 82 | 83 | $('#plugins.download .toggle-all').on('click', function (e) { 84 | e.preventDefault() 85 | inputsPlugin.attr('checked', !inputsPlugin.is(':checked')) 86 | }) 87 | 88 | $('#variables.download .toggle-all').on('click', function (e) { 89 | e.preventDefault() 90 | inputsVariables.val('') 91 | }) 92 | 93 | // request built javascript 94 | $('.download-btn .btn').on('click', function () { 95 | 96 | var css = $("#components.download input:checked") 97 | .map(function () { return this.value }) 98 | .toArray() 99 | , js = $("#plugins.download input:checked") 100 | .map(function () { return this.value }) 101 | .toArray() 102 | , vars = {} 103 | , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png'] 104 | 105 | $("#variables.download input") 106 | .each(function () { 107 | $(this).val() && (vars[ $(this).prev().text() ] = $(this).val()) 108 | }) 109 | 110 | $.ajax({ 111 | type: 'POST' 112 | , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com' 113 | , dataType: 'jsonpi' 114 | , params: { 115 | js: js 116 | , css: css 117 | , vars: vars 118 | , img: img 119 | } 120 | }) 121 | }) 122 | }) 123 | 124 | // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi 125 | $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) { 126 | var url = opts.url; 127 | 128 | return { 129 | send: function(_, completeCallback) { 130 | var name = 'jQuery_iframe_' + jQuery.now() 131 | , iframe, form 132 | 133 | iframe = $('