diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index 69ca1ead752..9b0337db16e 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -58,7 +58,6 @@ 'web/static/fonts/fonts.scss', 'web/static/lib/fontawesome/css/font-awesome.css', 'point_of_sale/static/src/css/pos.css', - 'point_of_sale/static/src/css/keyboard.css', 'point_of_sale/static/src/css/pos_receipts.css', 'point_of_sale/static/src/css/popups/product_info_popup.css', 'point_of_sale/static/src/css/popups/common.css', @@ -78,7 +77,6 @@ 'point_of_sale/static/src/js/Registries.js', 'point_of_sale/static/src/js/db.js', 'point_of_sale/static/src/js/models.js', - 'point_of_sale/static/src/js/keyboard.js', 'point_of_sale/static/src/js/barcode_reader.js', 'point_of_sale/static/src/js/printers.js', 'point_of_sale/static/src/js/Gui.js', diff --git a/addons/point_of_sale/static/src/css/keyboard.css b/addons/point_of_sale/static/src/css/keyboard.css deleted file mode 100644 index ee5fcfe35a7..00000000000 --- a/addons/point_of_sale/static/src/css/keyboard.css +++ /dev/null @@ -1,153 +0,0 @@ -/* Onscreen Keyboard http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/ */ - -/*rtl:ignore*/ -.pos .keyboard_frame{ - display: none; - position:absolute; - left: 0; - bottom: 0px; - margin: 0; - padding: 0; - padding-top: 15px; - width: 100%; - height: 0px; /* 235px, animated via jquery */ - background-color: #BBB; - overflow:hidden; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - z-index:10000; -} -.pos .keyboard_frame .close_button{ - height:40px; - width:60px; - text-align:center; - background-color: #DDD; - font-size: 12px; - line-height:40px; - -webkit-border-radius: 5px; - position:absolute; - top:0; - right:15px; - cursor: pointer; -} -/*rtl:ignore*/ -.pos .keyboard li { - float: left; - text-align: center; - background-color: #fff; - border: 1px solid #f0f0f0; - top:0; - cursor: pointer; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - -webkit-transition-property: top, background-color; - -webkit-transition-duration: 0.2s; - -webkit-transition-timing-function: linear; -} -/*rtl:ignore*/ -.pos .keyboard li:active{ - position: relative; - top: 2px; - left: 0px; - border-color: #ddd; - background-color:#e5e5e5; - cursor: pointer; - -webkit-transition-property: top, background-color; - -webkit-transition-duration: 0.1s; - -webkit-transition-timing-function: ease-out; -} -.pos .uppercase { - text-transform: uppercase; -} -.pos .on { - display: none; -} -/*rtl:ignore*/ -.pos .firstitem{ - clear: left; -} -/*rtl:ignore*/ -.pos .keyboard .lastitem { - margin-right: 0 !important; -} - -/* ---- full sized keyboard ---- */ - -.pos .full_keyboard { - list-style: none; - font-size: 14px; - width: 685px; - height: 100%; - margin-left: auto !important; - margin-right: auto !important; -} -/*rtl:ignore*/ -.pos .full_keyboard li{ - margin: 0 5px 5px 0 !important; - width: 40px; - height: 40px; - line-height: 40px; -} -.pos .full_keyboard .tab, .pos .full_keyboard .delete { - width: 70px; -} -.pos .full_keyboard .capslock { - width: 80px; -} -.pos .full_keyboard .return { - width: 77px; -} -.pos .full_keyboard .left-shift { - width: 95px; -} -.pos .full_keyboard .right-shift { - width: 109px; -} - -/*rtl:ignore*/ -.pos .full_keyboard .space { - clear: left; - width: 673px; -} - -/* ---- simplified keyboard ---- */ - -.pos .simple_keyboard { - list-style: none; - font-size: 16px; - width: 555px; - height: 220px; - margin-left: auto !important; - margin-right: auto !important; -} -/*rtl:ignore*/ -.pos .simple_keyboard li{ - margin: 0 5px 5px 0 !important; - width: 49px; - height: 49px; - line-height: 49px; -} -/*rtl:ignore*/ -.pos .simple_keyboard .firstitem.row_asdf{ - margin-left:25px !important; -} -/*rtl:ignore*/ -.pos .simple_keyboard .firstitem.row_zxcv{ - margin-left:55px !important; -} -.pos .simple_keyboard .delete{ - width: 103px; -} -.pos .simple_keyboard .return{ - width: 103px; -} -.pos .simple_keyboard .space{ - width:273px; -} -.pos .simple_keyboard .numlock{ - width:103px; -} diff --git a/addons/point_of_sale/static/src/js/keyboard.js b/addons/point_of_sale/static/src/js/keyboard.js deleted file mode 100644 index a9ea1f55553..00000000000 --- a/addons/point_of_sale/static/src/js/keyboard.js +++ /dev/null @@ -1,207 +0,0 @@ -odoo.define('point_of_sale.keyboard', function (require) { -"use strict"; - -var Widget = require('web.Widget'); - -// ---------- OnScreen Keyboard Widget ---------- -// A Widget that displays an onscreen keyboard. -// There are two options when creating the widget : -// -// * 'keyboard_model' : 'simple' (default) | 'full' -// The 'full' emulates a PC keyboard, while 'simple' emulates an 'android' one. -// -// * 'input_selector : (default: '.searchbox input') -// defines the dom element that the keyboard will write to. -// -// The widget is initially hidden. It can be shown with this.show(), and is -// automatically shown when the input_selector gets focused. - -var OnscreenKeyboardWidget = Widget.extend({ - template: 'OnscreenKeyboardSimple', - init: function(parent, options){ - this._super(parent,options); - options = options || {}; - - this.keyboard_model = options.keyboard_model || 'simple'; - if(this.keyboard_model === 'full'){ - this.template = 'OnscreenKeyboardFull'; - } - - this.input_selector = options.input_selector || '.searchbox input'; - this.$target = null; - - //Keyboard state - this.capslock = false; - this.shift = false; - this.numlock = false; - }, - - connect : function(target){ - var self = this; - this.$target = $(target); - this.$target.focus(function(){self.show();}); - }, - generateEvent: function(type,key){ - var event = document.createEvent("KeyboardEvent"); - var initMethod = event.initKeyboardEvent ? 'initKeyboardEvent' : 'initKeyEvent'; - event[initMethod]( type, - true, //bubbles - true, //cancelable - window, //viewArg - false, //ctrl - false, //alt - false, //shift - false, //meta - ((typeof key.code === 'undefined') ? key.char.charCodeAt(0) : key.code), - ((typeof key.char === 'undefined') ? String.fromCharCode(key.code) : key.char) - ); - return event; - - }, - - // Write a character to the input zone - writeCharacter: function(character){ - var input = this.$target[0]; - input.dispatchEvent(this.generateEvent('keypress',{char: character})); - if(character !== '\n'){ - input.value += character; - } - input.dispatchEvent(this.generateEvent('keyup',{char: character})); - }, - - // Removes the last character from the input zone. - deleteCharacter: function(){ - var input = this.$target[0]; - input.dispatchEvent(this.generateEvent('keypress',{code: 8})); - input.value = input.value.substr(0, input.value.length -1); - input.dispatchEvent(this.generateEvent('keyup',{code: 8})); - }, - - // Clears the content of the input zone. - deleteAllCharacters: function(){ - var input = this.$target[0]; - if(input.value){ - input.dispatchEvent(this.generateEvent('keypress',{code: 8})); - input.value = ""; - input.dispatchEvent(this.generateEvent('keyup',{code: 8})); - } - }, - - // Makes the keyboard show and slide from the bottom of the screen. - show: function(){ - $('.keyboard_frame').show().css({'height':'235px'}); - }, - - // Makes the keyboard hide by sliding to the bottom of the screen. - hide: function(){ - $('.keyboard_frame') - .css({'height':'0'}) - .hide(); - this.reset(); - }, - - //What happens when the shift key is pressed : toggle case, remove capslock - toggleShift: function(){ - $('.letter').toggleClass('uppercase'); - $('.symbol span').toggle(); - - this.shift = (this.shift === true) ? false : true; - this.capslock = false; - }, - - //what happens when capslock is pressed : toggle case, set capslock - toggleCapsLock: function(){ - $('.letter').toggleClass('uppercase'); - this.capslock = true; - }, - - //What happens when numlock is pressed : toggle symbols and numlock label - toggleNumLock: function(){ - $('.symbol span').toggle(); - $('.numlock span').toggle(); - this.numlock = (this.numlock === true ) ? false : true; - }, - - //After a key is pressed, shift is disabled. - removeShift: function(){ - if (this.shift === true) { - $('.symbol span').toggle(); - if (this.capslock === false) $('.letter').toggleClass('uppercase'); - - this.shift = false; - } - }, - - // Resets the keyboard to its original state; capslock: false, shift: false, numlock: false - reset: function(){ - if(this.shift){ - this.toggleShift(); - } - if(this.capslock){ - this.toggleCapsLock(); - } - if(this.numlock){ - this.toggleNumLock(); - } - }, - - //called after the keyboard is in the DOM, sets up the key bindings. - start: function(){ - var self = this; - - //this.show(); - - - $('.close_button').click(function(){ - self.deleteAllCharacters(); - self.hide(); - }); - - // Keyboard key click handling - $('.keyboard li').click(function(){ - - var $this = $(this), - character = $this.html(); // If it's a lowercase letter, nothing happens to this variable - - if ($this.hasClass('left-shift') || $this.hasClass('right-shift')) { - self.toggleShift(); - return false; - } - - if ($this.hasClass('capslock')) { - self.toggleCapsLock(); - return false; - } - - if ($this.hasClass('delete')) { - self.deleteCharacter(); - return false; - } - - if ($this.hasClass('numlock')){ - self.toggleNumLock(); - return false; - } - - // Special characters - if ($this.hasClass('symbol')) character = $('span:visible', $this).html(); - if ($this.hasClass('space')) character = ' '; - if ($this.hasClass('tab')) character = "\t"; - if ($this.hasClass('return')) character = "\n"; - - // Uppercase letter - if ($this.hasClass('uppercase')) character = character.toUpperCase(); - - // Remove shift once a key is clicked. - self.removeShift(); - - self.writeCharacter(character); - }); - }, -}); - -return { - OnscreenKeyboardWidget: OnscreenKeyboardWidget, -}; - -});