diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
| commit | 1ca3b3df3421961caec3b747a364071c80f5c7da (patch) | |
| tree | 6778a1f0f3f9b4c6e26d6d87ccde16e24da6c9d6 /base_accounting_kit/static/lib/bootstrap-toggle-master/doc/script.js | |
| parent | b57188be371d36d96caac4b8d65a40745c0e972c (diff) | |
initial commit
Diffstat (limited to 'base_accounting_kit/static/lib/bootstrap-toggle-master/doc/script.js')
| -rw-r--r-- | base_accounting_kit/static/lib/bootstrap-toggle-master/doc/script.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/base_accounting_kit/static/lib/bootstrap-toggle-master/doc/script.js b/base_accounting_kit/static/lib/bootstrap-toggle-master/doc/script.js new file mode 100644 index 0000000..863728a --- /dev/null +++ b/base_accounting_kit/static/lib/bootstrap-toggle-master/doc/script.js @@ -0,0 +1,49 @@ ++function ($) { + 'use strict'; + + $('.example:not(.skip)').each(function() { + // fetch & encode html + var html = $('<div>').text($(this).html()).html() + // find number of space/tabs on first line (minus line break) + var count = html.match(/^(\s+)/)[0].length - 1 + // replace tabs/spaces on each lines with + var regex = new RegExp('\\n\\s{'+count+'}', 'g') + var code = html.replace(regex, '\n').replace(/\t/g, ' ').trim() + // other cleanup + code = code.replace(/=""/g,'') + // add code block to dom + $(this).after( $('<code class="highlight html">').html(code) ) + }); + + $('code.highlight').each(function() { + hljs.highlightBlock(this) + }); + +}(jQuery); + +var Demo = function () {} + +Demo.prototype.init = function(selector) { + $(selector).bootstrapToggle(selector) +} +Demo.prototype.destroy = function(selector) { + $(selector).bootstrapToggle('destroy') +} +Demo.prototype.on = function(selector) { + $(selector).bootstrapToggle('on') +} +Demo.prototype.off = function(selector) { + $(selector).bootstrapToggle('off') +} +Demo.prototype.toggle = function(selector) { + $(selector).bootstrapToggle('toggle') +} +Demo.prototype.enable = function(selector) { + $(selector).bootstrapToggle('enable') +} +Demo.prototype.disable = function(selector) { + $(selector).bootstrapToggle('disable') +} + + +demo = new Demo() |
