scratch – Blame information for rev 79
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
79 | office | 1 | +function ($) { |
2 | 'use strict'; |
||
3 | |||
4 | $('.example:not(.skip)').each(function() { |
||
5 | // fetch & encode html |
||
6 | var html = $('<div>').text($(this).html()).html() |
||
7 | // find number of space/tabs on first line (minus line break) |
||
8 | var count = html.match(/^(\s+)/)[0].length - 1 |
||
9 | // replace tabs/spaces on each lines with |
||
10 | var regex = new RegExp('\\n\\s{'+count+'}', 'g') |
||
11 | var code = html.replace(regex, '\n').replace(/\t/g, ' ').trim() |
||
12 | // other cleanup |
||
13 | code = code.replace(/=""/g,'') |
||
14 | // add code block to dom |
||
15 | $(this).after( $('<code class="highlight html">').html(code) ) |
||
16 | }); |
||
17 | |||
18 | $('code.highlight').each(function() { |
||
19 | hljs.highlightBlock(this) |
||
20 | }); |
||
21 | |||
22 | }(jQuery); |
||
23 | |||
24 | var Demo = function () {} |
||
25 | |||
26 | Demo.prototype.init = function(selector) { |
||
27 | $(selector).bootstrapToggle(selector) |
||
28 | } |
||
29 | Demo.prototype.destroy = function(selector) { |
||
30 | $(selector).bootstrapToggle('destroy') |
||
31 | } |
||
32 | Demo.prototype.on = function(selector) { |
||
33 | $(selector).bootstrapToggle('on') |
||
34 | } |
||
35 | Demo.prototype.off = function(selector) { |
||
36 | $(selector).bootstrapToggle('off') |
||
37 | } |
||
38 | Demo.prototype.toggle = function(selector) { |
||
39 | $(selector).bootstrapToggle('toggle') |
||
40 | } |
||
41 | Demo.prototype.enable = function(selector) { |
||
42 | $(selector).bootstrapToggle('enable') |
||
43 | } |
||
44 | Demo.prototype.disable = function(selector) { |
||
45 | $(selector).bootstrapToggle('disable') |
||
46 | } |
||
47 | |||
48 | |||
49 | demo = new Demo() |