(function(window, $, undefined) {
(function() {
var VERSION = '1.0',
pluginName = 'calculator',
autoInitSelector = '.calculator-here',
$body, $calculatorsContainer,
containerBuilt = false,
baseTemplate = ''
'
displayMode: 'extended', showIcon: false, icon: 'fa-calculator', position: 'bottom left', textAlignment: 'rtl', theme: 'material', buttonStyle: null, showMethod: 'click', showEvent: 'focus', offset: 12, keyboardNav: true, clearKey: null, plsmnsKey: null, percKey: null, readOnly: true, classes: '', inline: false, autoClose: false, // calcID: null, // events onInput: function() {}, onResult: function() {}, onSelect: '', onShow: '', onHide: '', }, calculator; var Calculator = function(el, options) { this.el = el; this.$el = $(el); this.opts = $.extend(true, {}, defaults, options, this.$el.data()); if ($body === undefined) { $body = $('body'); } if (this.el.nodeName == 'INPUT') { this.elIsInput = true; } this.inited = false; this.visible = false; this.silent = false; // Need to prevent unnecessary rendering this.keys = []; // this._createShortCuts(); this.init() }; calculator = Calculator; calculator.prototype = { VERSION: VERSION, init: function() { if (!containerBuilt && !this.opts.inline && this.elIsInput) { this._buildCalculatorsContainer(); } this._buildBaseHtml(); if (this.elIsInput) { if (!this.opts.inline) { // Set extra classes for proper transitions this._setPositionClasses(this.opts.position); this._bindEvents() } this.$calculator.on('mousedown', this._onMouseDownCalculator.bind(this)); this.$calculator.on('mouseup', this._onMouseUpCalculator.bind(this)); } if (this.opts.classes) { this.$calculator.addClass(this.opts.classes) } if (this.opts.keyboardNav) { this._bindKeyboardEvents(); } // this.opts.calcID = 'jCalc_' Math.floor(Math.random() * 10000000 10000); new $.fn.calculator.Body(this, '', this.opts); this.inited = true; }, /* Keyboard binding */ _bindKeyboardEvents: function() { this.$el.on('keydown.adp', this._onKeyDown.bind(this)); this.$el.on('keyup.adp', this._onKeyUp.bind(this)); this.$el.on('hotKey.adp', this._onHotKey.bind(this)); }, _onKeyDown: function(e) { var code = e.which; this._registerKey(code); if ((code >= 96 && code <p>})(window, jQuery);</p>
The above is the detailed content of JCALCULATOR. For more information, please follow other related articles on the PHP Chinese website!