/** * Start the Settings App */ public function admin_inline_js() { $params = new WC_POS_Params(); echo '<script type="text/javascript">POS.options = ' . $params->toJSON() . '; POS.start();</script>'; }
/** * Output the footer scripts */ protected function footer() { // $build = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? 'build' : 'min'; // required scripts $scripts = array('jquery' => 'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js', 'lodash' => 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js', 'backbone' => 'https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.2/backbone-min.js', 'radio' => 'https://cdnjs.cloudflare.com/ajax/libs/backbone.radio/1.0.1/backbone.radio.min.js', 'marionette' => 'https://cdnjs.cloudflare.com/ajax/libs/backbone.marionette/2.4.2/backbone.marionette.min.js', 'handlebars' => 'https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/3.0.3/handlebars.min.js', 'select2' => 'https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js', 'moment' => 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js', 'accounting' => 'https://cdnjs.cloudflare.com/ajax/libs/accounting.js/0.4.1/accounting.min.js', 'jquery.color' => 'https://cdnjs.cloudflare.com/ajax/libs/jquery-color/2.1.2/jquery.color.min.js', 'app' => WC_POS_PLUGIN_URL . 'assets/js/app.' . $build . '.js?ver=' . WC_POS_VERSION); // cdn bundle for local dev // todo: formatNumber issue when using vendor bundle // $scripts = array( // 'bundle' => WC_POS_PLUGIN_URL .'assets/js/vendor.bundle.js?ver='. WC_POS_VERSION, // 'app' => WC_POS_PLUGIN_URL .'assets/js/app.'. $build .'.js?ver='. WC_POS_VERSION // ); // output scripts $scripts = apply_filters('woocommerce_pos_enqueue_scripts', $scripts); foreach ($scripts as $script) { echo "\n" . '<script src="' . $script . '"></script>'; } // inline start app with params $params = new WC_POS_Params(); $inline = array('start' => '<script type="text/javascript">POS.options = ' . $params->toJSON() . '; POS.start();</script>'); $inline_js = apply_filters('woocommerce_pos_inline_js', $inline); // output inline js foreach ($inline_js as $js) { echo "\n" . $js; } }
/** * Output the footer scripts */ protected function footer() { foreach ($this->get_scripts() as $script) { echo "\n" . '<script src="' . $script . '"></script>'; } // inline start app with params $params = new WC_POS_Params(); $inline = array('start' => '<script type="text/javascript">POS.options = ' . $params->toJSON() . '; POS.start();</script>'); $inline_js = apply_filters('woocommerce_pos_inline_js', $inline); // output inline js foreach ($inline_js as $js) { echo "\n" . $js; } }