Skip to content

Instantly share code, notes, and snippets.

View KeenthemesHub's full-sized avatar

Keenthemes KeenthemesHub

View GitHub Profile
@KeenthemesHub
KeenthemesHub / webpack.config.js
Created July 28, 2023 04:47
webpack html build tool. theme/tools/webpack.config.js
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
const del = require('del');
const glob = require('glob');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserJSPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const WebpackMessages = require('webpack-messages');
@KeenthemesHub
KeenthemesHub / webpack.config.js
Created July 27, 2023 07:33
webpack html build
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
const del = require('del');
const glob = require('glob');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserJSPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const WebpackMessages = require('webpack-messages');
@KeenthemesHub
KeenthemesHub / button-ajax.js
Created April 7, 2023 03:03
starterkit/resources/mix/common/button-ajax.js
$(document).on('click', '.button-ajax', function (e) {
e.preventDefault();
var action = $(this).data('action');
var method = $(this).data('method');
var csrf = $(this).data('csrf');
var reload = $(this).data('reload');
axios.request({
url: action,
method: method,
@KeenthemesHub
KeenthemesHub / _init.js
Created November 21, 2022 14:37
Place this file in resources/assets/core/js/components/_init.js
//
// Global init of core components
//
// Init components
var KTComponents = function () {
// Public methods
return {
init: function () {
KTApp.init();
@KeenthemesHub
KeenthemesHub / getSvgIcon.php
Created December 1, 2020 06:12
Include inline SVG code using PHP function
public static function getSvgIcon($path, $class = '', $svgClass = '') {
$full_path = $path;
if ( ! file_exists($path)) {
return '<!-- SVG file not found; '.$path.' -->';
}
$svg_content = file_get_contents($path);
$dom = new DOMDocument();
$dom->loadXML($svg_content);
public static function getSvgIcon($path, $class = '', $svgClass = '') {
$full_path = $path;
if ( ! file_exists($path)) {
return '<!-- SVG file not found; '.$path.' -->';
}
$svg_content = file_get_contents($path);
$dom = new DOMDocument();
$dom->loadXML($svg_content);
/**
* Destroy datatable to original DOM state before datatable was
* initialized
* @returns {jQuery}
*/
destroy: function() {
$(datatable).parent().find('.' + pfx + 'datatable-pager').remove();
var initialDatatable = $(datatable.initialDatatable).addClass(pfx + 'datatable-destroyed').show();
$(datatable).replaceWith(initialDatatable);
@KeenthemesHub
KeenthemesHub / core.datatable.js
Created February 12, 2019 16:51
mDatatable dev
'use strict';
(function($) {
var pluginName = 'mDatatable';
var pfx = 'm-';
var util = mUtil;
var app = mApp;
if (typeof util === 'undefined') throw new Error('Util class is required and must be included before ' + pluginName);
@KeenthemesHub
KeenthemesHub / dt
Last active February 3, 2019 02:25
'use strict';
// Class definition
var DatatableItems = function() {
// Private functions
// basic demo
var createTable = function() {
// var arrayOfObjects = [{"id":28,"Title":"Sweden"}, {"id":56,"Title":"USA"}, {"id":89,"Title":"England"}];