cms/resources/js/app-common.js

41 lines
988 B
JavaScript
Vendored
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {dataTable} from "./utils/datatable";
import {block, blockElement, unblock, unblockElement} from "./utils/blockui";
import {init as initSelect2} from './utils/select2';
$('.logout-btn').on('click', e => {
e.preventDefault()
$('#logout-form').submit()
})
/**
* 第三方工具
*/
app.utils = {
dataTable: dataTable,
blockui: {
blockElement: blockElement,
unblockElement: unblockElement,
block: block,
unblock: unblock
},
select2: initSelect2,
}
app.methods = {
/**
* 檢查是否符合給定的Media Query
* 預設為max-width
* */
matchMedia: function(value, directive = 'max-width') {
return window.matchMedia('(' + directive + ': ' + value + ')').matches;
},
/**
* 檢查是否符合給定的Media Query單位為px
* 預設為max-width
* */
matchMediaInPx(value, directive = 'max-width') {
return this.matchMedia(value + 'px', directive);
},
}