/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/passport/AuthorizedClients.vue?vue&type=script&lang=js&": /*!****************************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/passport/AuthorizedClients.vue?vue&type=script&lang=js& ***! \****************************************************************************************************************************************************************************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ props: ['clientsUrl', 'tokensUrl'], /* * The component's data. */ data: function data() { return { tokens: [] }; }, /** * Prepare the component (Vue 1.x). */ ready: function ready() { this.prepareComponent(); }, /** * Prepare the component (Vue 2.x). */ mounted: function mounted() { this.prepareComponent(); }, methods: { /** * Prepare the component (Vue 2.x). */ prepareComponent: function prepareComponent() { this.getTokens(); }, /** * Get all of the authorized tokens for the user. */ getTokens: function getTokens() { var _this = this; this.$http.get(this.tokensUrl).then(function (response) { _this.tokens = response.data; }); }, /** * Revoke the given token. */ revoke: function revoke(token) { var _this2 = this; this.$http["delete"](this.tokensUrl + '/' + token.id).then(function (response) { _this2.getTokens(); }); } } }); /***/ }), /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/passport/Clients.vue?vue&type=script&lang=js&": /*!******************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/passport/Clients.vue?vue&type=script&lang=js& ***! \******************************************************************************************************************************************************************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ /* * The component's data. */ props: ['clientsUrl'], data: function data() { return { clients: [], createForm: { errors: [], name: '', redirect: '' }, editForm: { errors: [], name: '', redirect: '' } }; }, /** * Prepare the component (Vue 1.x). */ ready: function ready() { this.prepareComponent(); }, /** * Prepare the component (Vue 2.x). */ mounted: function mounted() { this.prepareComponent(); }, methods: { /** * Prepare the component. */ prepareComponent: function prepareComponent() { this.getClients(); $('#modal-create-client').on('shown.bs.modal', function () { $('#create-client-name').focus(); }); $('#modal-edit-client').on('shown.bs.modal', function () { $('#edit-client-name').focus(); }); }, /** * Get all of the OAuth clients for the user. */ getClients: function getClients() { var _this = this; this.$http.get(this.clientsUrl).then(function (response) { _this.clients = response.data; }); }, /** * Show the form for creating new clients. */ showCreateClientForm: function showCreateClientForm() { $('#modal-create-client').modal('show'); }, /** * Create a new OAuth client for the user. */ store: function store() { this.persistClient('post', this.clientsUrl, this.createForm, '#modal-create-client'); }, /** * Edit the given client. */ edit: function edit(client) { this.editForm.id = client.id; this.editForm.name = client.name; this.editForm.redirect = client.redirect; $('#modal-edit-client').modal('show'); }, /** * Update the client being edited. */ update: function update() { this.persistClient('put', this.clientsUrl + '/' + this.editForm.id, this.editForm, '#modal-edit-client'); }, /** * Persist the client to storage using the given form. */ persistClient: function persistClient(method, uri, form, modal) { var _this2 = this; console.log('persisting'); form.errors = []; console.log('method: ' + method); this.$http[method](uri, form).then(function (response) { _this2.getClients(); form.name = ''; form.redirect = ''; form.errors = []; $(modal).modal('hide'); })["catch"](function (response) { if (_typeof(response.data) === 'object') { form.errors = _.flatten(_.toArray(response.data)); } else { form.errors = ['Something went wrong. Please try again.']; } }); }, /** * Destroy the given client. */ destroy: function destroy(client) { var _this3 = this; this.$http["delete"](this.clientsUrl + '/' + client.id).then(function (response) { _this3.getClients(); }); } } }); /***/ }), /***/ "./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/passport/PersonalAccessTokens.vue?vue&type=script&lang=js&": /*!*******************************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/passport/PersonalAccessTokens.vue?vue&type=script&lang=js& ***! \*******************************************************************************************************************************************************************************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ props: ['tokenUrl', 'scopesUrl'], /* * The component's data. */ data: function data() { return { accessToken: null, tokens: [], scopes: [], form: { name: '', scopes: [], errors: [] } }; }, /** * Prepare the component (Vue 1.x). */ ready: function ready() { this.prepareComponent(); }, /** * Prepare the component (Vue 2.x). */ mounted: function mounted() { this.prepareComponent(); }, methods: { /** * Prepare the component. */ prepareComponent: function prepareComponent() { this.getTokens(); this.getScopes(); $('#modal-create-token').on('shown.bs.modal', function () { $('#create-token-name').focus(); }); }, /** * Get all of the personal access tokens for the user. */ getTokens: function getTokens() { var _this = this; this.$http.get(this.tokenUrl).then(function (response) { _this.tokens = response.data; }); }, /** * Get all of the available scopes. */ getScopes: function getScopes() { var _this2 = this; this.$http.get(this.scopesUrl).then(function (response) { _this2.scopes = response.data; }); }, /** * Show the form for creating new tokens. */ showCreateTokenForm: function showCreateTokenForm() { $('#modal-create-token').modal('show'); }, /** * Create a new personal access token. */ store: function store() { var _this3 = this; this.accessToken = null; this.form.errors = []; this.$http.post(this.tokenUrl, this.form).then(function (response) { _this3.form.name = ''; _this3.form.scopes = []; _this3.form.errors = []; _this3.tokens.push(response.data.token); _this3.showAccessToken(response.data.accessToken); })["catch"](function (response) { if (_typeof(response.data) === 'object') { _this3.form.errors = _.flatten(_.toArray(response.data)); } else { console.dir(_this3.form); _this3.form.errors = ['Something went wrong. Please try again.']; } }); }, /** * Toggle the given scope in the list of assigned scopes. */ toggleScope: function toggleScope(scope) { if (this.scopeIsAssigned(scope)) { this.form.scopes = _.reject(this.form.scopes, function (s) { return s == scope; }); } else { this.form.scopes.push(scope); } }, /** * Determine if the given scope has been assigned to the token. */ scopeIsAssigned: function scopeIsAssigned(scope) { return _.indexOf(this.form.scopes, scope) >= 0; }, /** * Show the given access token to the user. */ showAccessToken: function showAccessToken(accessToken) { $('#modal-create-token').modal('hide'); this.accessToken = accessToken; $('#modal-access-token').modal('show'); }, /** * Revoke the given token. */ revoke: function revoke(token) { var _this4 = this; this.$http["delete"](this.tokenUrl + '/' + token.id).then(function (response) { _this4.getTokens(); }); } } }); /***/ }), /***/ "./resources/assets/js/bootstrap.js": /*!******************************************!*\ !*** ./resources/assets/js/bootstrap.js ***! \******************************************/ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); /** * We'll load jQuery and the Bootstrap jQuery plugin which provides support * for JavaScript based Bootstrap features such as modals and tabs. This * code may be modified to fit the specific needs of your application. */ //window.$ = window.jQuery = require('jquery'); /** * jQuery UI is loaded here and then the tooltip is assigned another funtion name * This resolves the issue of jquery-ui & bootstrap tooltip conflict */ __webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui/ui/widget.js"); jQuery.fn.uitooltip = jQuery.fn.tooltip; /** * Load boostrap */ __webpack_require__(/*! bootstrap-less */ "./node_modules/bootstrap-less/js/bootstrap.js"); /** * Vue is a modern JavaScript library for building interactive web interfaces * using reactive data binding and reusable components. Vue's API is clean * and simple, leaving you to focus on building your next great project. */ window.Vue = (__webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm.js")["default"]); window.eventHub = new Vue(); __webpack_require__(/*! vue-resource */ "./node_modules/vue-resource/dist/vue-resource.esm.js"); /** * We'll register a HTTP interceptor to attach the "CSRF" header to each of * the outgoing requests issued by this application. The CSRF middleware * included with Laravel will automatically verify the header's value. */ Vue.http.interceptors.push(function (request, next) { request.headers.set('X-CSRF-TOKEN', Laravel.csrfToken); next(); }); // require('admin-lte'); // require('chart.js'); // require('jquery-form-validator'); //says something about dependency /** * Echo exposes an expressive API for subscribing to channels and listening * for events that are broadcast by Laravel. Echo and event broadcasting * allows your team to easily build robust real-time web applications. */ // import Echo from "laravel-echo" // window.Echo = new Echo({ // broadcaster: 'pusher', // key: 'your-pusher-key' // }); /***/ }), /***/ "./resources/assets/js/snipeit.js": /*!****************************************!*\ !*** ./resources/assets/js/snipeit.js ***! \****************************************/ /***/ (() => { // var jQuery = require('jquery'); // window.jQuery = jQuery // window.$ = jQuery /** * Module containing core application logic. * @param {jQuery} $ Insulated jQuery object * @param {JSON} settings Insulated `window.snipeit.settings` object. * @return {IIFE} Immediately invoked. Returns self. */ lineOptions = { legend: { position: "bottom" }, scales: { yAxes: [{ ticks: { fontColor: "rgba(0,0,0,0.5)", fontStyle: "bold", beginAtZero: true, maxTicksLimit: 5, padding: 20 }, gridLines: { drawTicks: false, display: false } }], xAxes: [{ gridLines: { zeroLineColor: "transparent" }, ticks: { padding: 20, fontColor: "rgba(0,0,0,0.5)", fontStyle: "bold" } }] } }; pieOptions = { //Boolean - Whether we should show a stroke on each segment segmentShowStroke: true, //String - The colour of each segment stroke segmentStrokeColor: "#fff", //Number - The width of each segment stroke segmentStrokeWidth: 1, //Number - The percentage of the chart that we cut out of the middle percentageInnerCutout: 50, // This is 0 for Pie charts //Number - Amount of animation steps animationSteps: 100, //String - Animation easing effect animationEasing: "easeOutBounce", //Boolean - Whether we animate the rotation of the Doughnut animateRotate: true, //Boolean - Whether we animate scaling the Doughnut from the centre animateScale: false, //Boolean - whether to make the chart responsive to window resizing responsive: true, // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container maintainAspectRatio: false, //String - A legend template legendTemplate: "", //String - A tooltip template tooltipTemplate: "<%=value %> <%=label%> " }; //----------------- //- END PIE CHART - //----------------- var baseUrl = $('meta[name="baseUrl"]').attr('content'); (function ($, settings) { var Components = {}; Components.modals = {}; // confirm restore modal Components.modals.confirmRestore = function () { var $el = $('table'); var events = { 'click': function click(evnt) { var $context = $(this); var $restoreConfirmModal = $('#restoreConfirmModal'); var href = $context.attr('href'); var message = $context.attr('data-content'); var title = $context.attr('data-title'); $('#restoreConfirmModalLabel').text(title); $restoreConfirmModal.find('.modal-body').text(message); $('#restoreForm').attr('action', href); $restoreConfirmModal.modal({ show: true }); return false; } }; var render = function render() { $el.on('click', '.restore-asset', events['click']); }; return { render: render }; }; // confirm delete modal Components.modals.confirmDelete = function () { var $el = $('table'); var events = { 'click': function click(evnt) { var $context = $(this); var $dataConfirmModal = $('#dataConfirmModal'); var href = $context.attr('href'); var message = $context.attr('data-content'); var title = $context.attr('data-title'); $('#myModalLabel').text(title); $dataConfirmModal.find('.modal-body').text(message); $('#deleteForm').attr('action', href); $dataConfirmModal.modal({ show: true }); return false; } }; var render = function render() { $el.on('click', '.delete-asset', events['click']); }; return { render: render }; }; /** * Application start point * Component definition stays out of load event, execution only happens. */ $(function () { new Components.modals.confirmRestore().render(); new Components.modals.confirmDelete().render(); }); })(jQuery, window.snipeit.settings); $(document).ready(function () { /* * Slideout help menu */ $('.slideout-menu-toggle').on('click', function (event) { event.preventDefault(); // create menu variables var slideoutMenu = $('.slideout-menu'); var slideoutMenuWidth = $('.slideout-menu').width(); // toggle open class slideoutMenu.toggleClass("open"); // slide menu if (slideoutMenu.hasClass("open")) { slideoutMenu.show(); slideoutMenu.animate({ right: "0px" }); } else { slideoutMenu.animate({ right: -slideoutMenuWidth }, "-350px"); slideoutMenu.fadeOut(); } }); /* * Select2 */ var iOS = /iPhone|iPad|iPod/.test(navigator.userAgent) && !window.MSStream; if (!iOS) { // Vue collision: Avoid overriding a vue select2 instance // by checking to see if the item has already been select2'd. $('select.select2:not(".select2-hidden-accessible")').each(function (i, obj) { { $(obj).select2(); } }); } // $('.datepicker').datepicker(); // var datepicker = $.fn.datepicker.noConflict(); // return $.fn.datepicker to previously assigned value // $.fn.bootstrapDP = datepicker; // $('.datepicker').datepicker(); // Crazy select2 rich dropdowns with images! $('.js-data-ajax').each(function (i, item) { var link = $(item); var endpoint = link.data("endpoint"); var select = link.data("select"); link.select2({ /** * Adds an empty placeholder, allowing every select2 instance to be cleared. * This placeholder can be overridden with the "data-placeholder" attribute. */ placeholder: '', allowClear: true, ajax: { // the baseUrl includes a trailing slash url: baseUrl + 'api/v1/' + endpoint + '/selectlist', dataType: 'json', delay: 250, headers: { "X-Requested-With": 'XMLHttpRequest', "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') }, data: function data(params) { var data = { search: params.term, page: params.page || 1, assetStatusType: link.data("asset-status-type") }; return data; }, /* processResults: function (data, params) { params.page = params.page || 1; var answer = { results: data.items, pagination: { more: data.pagination.more } }; return answer; }, */ cache: true }, //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work templateResult: formatDatalistSafe //templateSelection: formatDataSelection }); }); function getSelect2Value(element) { // if the passed object is not a jquery object, assuming 'element' is a selector if (!(element instanceof jQuery)) element = $(element); var select = element.data("select2"); // There's two different locations where the select2-generated input element can be. searchElement = select.dropdown.$search || select.$container.find(".select2-search__field"); var value = searchElement.val(); return value; } $(".select2-hidden-accessible").on('select2:selecting', function (e) { var data = e.params.args.data; var isMouseUp = false; var element = $(this); var value = getSelect2Value(element); if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup"; // if selected item does not match typed text, do not allow it to pass - force close for ajax. if (!isMouseUp) { if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) < 0) { e.preventDefault(); element.select2('close'); // if it does match, we set a flag in the event (which gets passed to subsequent events), telling it not to worry about the ajax } else if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) > -1) { e.params.args.noForceAjax = true; } } }); $(".select2-hidden-accessible").on('select2:closing', function (e) { var element = $(this); var value = getSelect2Value(element); var noForceAjax = false; var isMouseUp = false; if (e.params.args.originalSelect2Event) noForceAjax = e.params.args.originalSelect2Event.noForceAjax; if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup"; if (value && !noForceAjax && !isMouseUp) { var endpoint = element.data("endpoint"); var assetStatusType = element.data("asset-status-type"); $.ajax({ url: baseUrl + 'api/v1/' + endpoint + '/selectlist?search=' + value + '&page=1' + (assetStatusType ? '&assetStatusType=' + assetStatusType : ''), dataType: 'json', headers: { "X-Requested-With": 'XMLHttpRequest', "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') } }).done(function (response) { var currentlySelected = element.select2('data').map(function (x) { return +x.id; }).filter(function (x) { return x !== 0; }); // makes sure we're not selecting the same thing twice for multiples var filteredResponse = response.results.filter(function (item) { return currentlySelected.indexOf(+item.id) < 0; }); var first = currentlySelected.length > 0 ? filteredResponse[0] : response.results[0]; if (first && first.id) { first.selected = true; if ($("option[value='" + first.id + "']", element).length < 1) { var option = new Option(first.text, first.id, true, true); element.append(option); } else { var isMultiple = element.attr("multiple") == "multiple"; element.val(isMultiple ? element.val().concat(first.id) : element.val(first.id)); } element.trigger('change'); element.trigger({ type: 'select2:select', params: { data: first } }); } }); } }); function formatDatalist(datalist) { var loading_markup = ' Loading...'; if (datalist.loading) { return loading_markup; } var markup = '
'; markup += '
'; if (datalist.image) { markup += "
" + datalist.text + "
"; } else { markup += '
'; } markup += "
" + datalist.text + "
"; markup += "
"; return markup; } function formatDatalistSafe(datalist) { // console.warn("What in the hell is going on with Select2?!?!!?!?"); // console.warn($.select2); if (datalist.loading) { return $(' Loading...'); } var root_div = $("
"); var left_pull = $("
"); if (datalist.image) { var inner_div = $("
"); /****************************************************************** * * We are specifically chosing empty alt-text below, because this * image conveys no additional information, relative to the text * that will *always* be there in any select2 list that is in use * in Snipe-IT. If that changes, we would probably want to change * some signatures of some functions, but right now, we don't want * screen readers to say "HP SuperJet 5000, .... picture of HP * SuperJet 5000..." and so on, for every single row in a list of * assets or models or whatever. * *******************************************************************/ var img = $(""); // console.warn("Img is: "); // console.dir(img); // console.warn("Strigularly, that's: "); // console.log(img); img.attr("src", datalist.image); inner_div.append(img); } else { var inner_div = $("
"); } left_pull.append(inner_div); root_div.append(left_pull); var name_div = $("
"); name_div.text(datalist.text); root_div.append(name_div); var safe_html = root_div.get(0).outerHTML; var old_html = formatDatalist(datalist); if (safe_html != old_html) {//console.log("HTML MISMATCH: "); //console.log("FormatDatalistSafe: "); // console.dir(root_div.get(0)); //console.log(safe_html); //console.log("FormatDataList: "); //console.log(old_html); } return root_div; } function formatDataSelection(datalist) { // This a heinous workaround for a known bug in Select2. // Without this, the rich selectlists are vulnerable to XSS. // Many thanks to @uberbrady for this fix. It ain't pretty, // but it resolves the issue until Select2 addresses it on their end. // // Bug was reported in 2016 :{ // https://github.com/select2/select2/issues/4587 return datalist.text.replace(/>/g, '>').replace(/Click me $('a[data-toggle="tab"]').click(function (e) { var href = $(this).attr("href"); history.pushState(null, null, href); e.preventDefault(); $('a[href="' + $(this).attr('href') + '"]').tab('show'); }); // ------------------------------------------------ // End Deep Linking for Bootstrap tabs // ------------------------------------------------ // Image preview function readURL(input, $preview) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $preview.attr('src', e.target.result); }; reader.readAsDataURL(input.files[0]); } } function formatBytes(bytes) { if (bytes < 1024) return bytes + " Bytes";else if (bytes < 1048576) return (bytes / 1024).toFixed(2) + " KB";else if (bytes < 1073741824) return (bytes / 1048576).toFixed(2) + " MB";else return (bytes / 1073741824).toFixed(2) + " GB"; } // File size validation $('.js-uploadFile').bind('change', function () { var $this = $(this); var id = '#' + $this.attr('id'); var status = id + '-status'; var $status = $(status); var delete_id = $(id + '-deleteCheckbox'); var preview_container = $(id + '-previewContainer'); $status.removeClass('text-success').removeClass('text-danger'); $(status + ' .goodfile').remove(); $(status + ' .badfile').remove(); $(status + ' .previewSize').hide(); preview_container.hide(); $(id + '-info').html(''); var max_size = $this.data('maxsize'); var total_size = 0; for (var i = 0; i < this.files.length; i++) { total_size += this.files[i].size; $(id + '-info').append('' + htmlEntities(this.files[i].name) + ' (' + formatBytes(this.files[i].size) + ') '); } if (total_size > max_size) { $status.addClass('text-danger').removeClass('help-block').prepend(' ').append(' Upload is ' + formatBytes(total_size) + '.'); } else { $status.addClass('text-success').removeClass('help-block').prepend(' '); var $preview = $(id + '-imagePreview'); readURL(this, $preview); $preview.fadeIn(); preview_container.fadeIn(); delete_id.hide(); } }); }); function htmlEntities(str) { return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } /** * Toggle disabled */ (function ($) { $.fn.toggleDisabled = function (callback) { return this.each(function () { var disabled, $this = $(this); if ($this.attr('disabled')) { $this.removeAttr('disabled'); disabled = false; } else { $this.attr('disabled', 'disabled'); disabled = true; } if (callback && typeof callback === 'function') { callback(this, disabled); } }); }; })(jQuery); /** * Universal Livewire Select2 integration * * How to use: * * 1. Set the class of your select2 elements to 'livewire-select2'). * 2. Name your element to match a property in your Livewire component * 3. Add an attribute called 'data-livewire-component' that points to $_instance->id (via `{{ }}` if you're in a blade, * or just $_instance->id if not). */ $(function () { $('.livewire-select2').select2(); $(document).on('select2:select', '.livewire-select2', function (event) { var target = $(event.target); if (!event.target.name || !target.data('livewire-component')) { console.error("You need to set both name (which should match a Livewire property) and data-livewire-component on your Livewire-ed select2 elements!"); console.error("For data-livewire-component, you probably want to use $_instance->id or {{ $_instance->id }}, as appropriate"); return false; } window.livewire.find(target.data('livewire-component')).set(event.target.name, this.options[this.selectedIndex].value); }); window.livewire.hook('message.processed', function (el, component) { $('.livewire-select2').select2(); }); }); /***/ }), /***/ "./resources/assets/js/snipeit_modals.js": /*!***********************************************!*\ !*** ./resources/assets/js/snipeit_modals.js ***! \***********************************************/ /***/ (() => { /* * * Snipe-IT Universal Modal support * * Enables modal dialogs to create sub-resources throughout Snipe-IT * */ /* HOW TO USE Create a Button looking like this: New If you don't have access to Blade commands (like {{ and }}, etc), you can hard-code a URL as the 'href' data-toggle="modal" - required for Bootstrap Modals data-target="#createModal" - fixed ID for the modal, do not change data-select="assigned_to" - What is the *ID* of the select-dropdown that you're going to be adding to, if the modal-create was a success? Be on the lookout for duplicate ID's, it will confuse this library! class="btn btn-sm btn-primary" - makes it look button-ey, feel free to change :) If you want to pass additional variables to the modal (In the Category Create one, for example, you can pass category_id), you can encode them as URL variables in the href */ $(function () { var baseUrl = $('meta[name="baseUrl"]').attr('content'); //handle modal-add-interstitial calls var model, select, refreshSelector; if ($('#createModal').length == 0) { $('body').append(''); } $('#createModal').on("show.bs.modal", function (event) { var link = $(event.relatedTarget); model = link.data("dependency"); select = link.data("select"); refreshSelector = link.data("refresh"); $('#createModal').load(link.attr('href'), function () { // this sets the focus to be the name field $('#modal-name').focus(); //do we need to re-select2 this, after load? Probably. $('#createModal').find('select.select2').select2(); // Initialize the ajaxy select2 with images. // This is a copy/paste of the code from snipeit.js, would be great to only have this in one place. $('.js-data-ajax').each(function (i, item) { var link = $(item); var endpoint = link.data("endpoint"); var select = link.data("select"); link.select2({ ajax: { // the baseUrl includes a trailing slash url: baseUrl + 'api/v1/' + endpoint + '/selectlist', //WARNING - we're hoping that's defined on the page somewhere... dataType: 'json', delay: 250, headers: { "X-Requested-With": 'XMLHttpRequest', "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') }, data: function data(params) { var data = { search: params.term, page: params.page || 1, assetStatusType: link.data("asset-status-type") }; return data; }, /*processResults: function (data, params) { params.page = params.page || 1; var answer = { results: data.items, pagination: { more: data.pagination.more } }; return answer; },*/ cache: true }, //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work templateResult: formatDatalistSafe //templateSelection: formatDataSelection }); }); }); }); $('#createModal').on('click', '#modal-save', function () { $.ajax({ type: 'POST', url: $('.modal-body form').attr('action'), headers: { "X-Requested-With": 'XMLHttpRequest', "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') }, data: $('.modal-body form').serialize(), success: function success(result) { if (result.status == "error") { var error_message = ""; for (var field in result.messages) { error_message += "
  • Problem(s) with field " + field + ": " + result.messages[field]; } $('#modal_error_msg').html(error_message).show(); return false; } var id = result.payload.id; var name = result.payload.name || result.payload.first_name + " " + result.payload.last_name; if (!id || !name) { console.error("Could not find resulting name or ID from modal-create. Name: " + name + ", id: " + id); return false; } $('#createModal').modal('hide'); $('#createModal').html(""); var refreshTable = $('#' + refreshSelector); if (refreshTable.length > 0) { refreshTable.bootstrapTable('refresh'); } // "select" is the original drop-down menu that someone // clicked 'add' on to add a new 'thing' // this code adds the newly created object to that select var selector = document.getElementById(select); if (!selector) { return false; } selector.options[selector.length] = new Option(name, id); selector.selectedIndex = selector.length - 1; $(selector).trigger("change"); if (window.fetchCustomFields) { fetchCustomFields(); } }, error: function error(result) { msg = result.responseJSON.messages || result.responseJSON.error; $('#modal_error_msg').html("Server Error: " + msg).show(); } }); }); }); function formatDatalistSafe(datalist) { // console.warn("What in the hell is going on with Select2?!?!!?!?"); // console.warn($.select2); if (datalist.loading) { return $(' Loading...'); } var root_div = $("
    "); var left_pull = $("
    "); if (datalist.image) { var inner_div = $("
    "); /****************************************************************** * * We are specifically chosing empty alt-text below, because this * image conveys no additional information, relative to the text * that will *always* be there in any select2 list that is in use * in Snipe-IT. If that changes, we would probably want to change * some signatures of some functions, but right now, we don't want * screen readers to say "HP SuperJet 5000, .... picture of HP * SuperJet 5000..." and so on, for every single row in a list of * assets or models or whatever. * *******************************************************************/ var img = $(""); // console.warn("Img is: "); // console.dir(img); // console.warn("Strigularly, that's: "); // console.log(img); img.attr("src", datalist.image); inner_div.append(img); } else { var inner_div = $("
    "); } left_pull.append(inner_div); root_div.append(left_pull); var name_div = $("
    "); name_div.text(datalist.text); root_div.append(name_div); var safe_html = root_div.get(0).outerHTML; var old_html = formatDatalist(datalist); if (safe_html != old_html) {// console.log("HTML MISMATCH: "); // console.log("FormatDatalistSafe: "); // console.dir(root_div.get(0)); // console.log(safe_html); // console.log("FormatDataList: "); // console.log(old_html); } return root_div; } function formatDatalist(datalist) { var loading_markup = ' Loading...'; if (datalist.loading) { return loading_markup; } var markup = "
    "; markup += "
    "; if (datalist.image) { markup += "
    " + datalist.tex + "
    "; } else { markup += "
    "; } markup += "
    " + datalist.text + "
    "; markup += "
    "; return markup; } function formatDataSelection(datalist) { return datalist.text.replace(/>/g, '>').replace(/ { /** * First we will load all of this project's JavaScript dependencies which * include Vue and Vue Resource. This gives a great starting point for * building robust, powerful web applications using Vue and Laravel. */ __webpack_require__(/*! ./bootstrap */ "./resources/assets/js/bootstrap.js"); /** * Next, we will create a fresh Vue application instance and attach it to * the page. Then, you may begin adding components to this application * or customize the JavaScript scaffolding to fit your unique needs. */ Vue.component('passport-clients', (__webpack_require__(/*! ./components/passport/Clients.vue */ "./resources/assets/js/components/passport/Clients.vue")["default"])); Vue.component('passport-authorized-clients', (__webpack_require__(/*! ./components/passport/AuthorizedClients.vue */ "./resources/assets/js/components/passport/AuthorizedClients.vue")["default"])); Vue.component('passport-personal-access-tokens', (__webpack_require__(/*! ./components/passport/PersonalAccessTokens.vue */ "./resources/assets/js/components/passport/PersonalAccessTokens.vue")["default"])); // This component has been removed and replaced with a Livewire implementation // Vue.component( // 'importer', // require('./components/importer/importer.vue').default // ); // This component has been removed and replaced with a Livewire implementation // Vue.component( // 'fieldset-default-values', // require('./components/forms/asset-models/fieldset-default-values.vue').default // ); // Commented out currently to avoid trying to load vue everywhere. // const app = new Vue({ // el: '#app' // }); /***/ }), /***/ "./node_modules/bootstrap-less/js/bootstrap.js": /*!*****************************************************!*\ !*** ./node_modules/bootstrap-less/js/bootstrap.js ***! \*****************************************************/ /***/ (() => { /* */ "format global"; "deps jquery"; "exports $"; /*! * Bootstrap v3.3.4 (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') } +function ($) { 'use strict'; var version = $.fn.jquery.split(' ')[0].split('.') if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) { throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher') } }(jQuery); /* ======================================================================== * Bootstrap: transition.js v3.3.4 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // ============================================================ function transitionEnd() { var el = document.createElement('bootstrap') var transEndEventNames = { WebkitTransition : 'webkitTransitionEnd', MozTransition : 'transitionend', OTransition : 'oTransitionEnd otransitionend', transition : 'transitionend' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { end: transEndEventNames[name] } } } return false // explicit for ie8 ( ._.) } // http://blog.alexmaccaw.com/css-transitions $.fn.emulateTransitionEnd = function (duration) { var called = false var $el = this $(this).one('bsTransitionEnd', function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this } $(function () { $.support.transition = transitionEnd() if (!$.support.transition) return $.event.special.bsTransitionEnd = { bindType: $.support.transition.end, delegateType: $.support.transition.end, handle: function (e) { if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) } } }) }(jQuery); /* ======================================================================== * Bootstrap: alert.js v3.3.4 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // ALERT CLASS DEFINITION // ====================== var dismiss = '[data-dismiss="alert"]' var Alert = function (el) { $(el).on('click', dismiss, this.close) } Alert.VERSION = '3.3.4' Alert.TRANSITION_DURATION = 150 Alert.prototype.close = function (e) { var $this = $(this) var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = $(selector) if (e) e.preventDefault() if (!$parent.length) { $parent = $this.closest('.alert') } $parent.trigger(e = $.Event('close.bs.alert')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { // detach from parent, fire event then clean up data $parent.detach().trigger('closed.bs.alert').remove() } $.support.transition && $parent.hasClass('fade') ? $parent .one('bsTransitionEnd', removeElement) .emulateTransitionEnd(Alert.TRANSITION_DURATION) : removeElement() } // ALERT PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.alert') if (!data) $this.data('bs.alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } var old = $.fn.alert $.fn.alert = Plugin $.fn.alert.Constructor = Alert // ALERT NO CONFLICT // ================= $.fn.alert.noConflict = function () { $.fn.alert = old return this } // ALERT DATA-API // ============== $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(jQuery); /* ======================================================================== * Bootstrap: button.js v3.3.4 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, Button.DEFAULTS, options) this.isLoading = false } Button.VERSION = '3.3.4' Button.DEFAULTS = { loadingText: 'loading...' } Button.prototype.setState = function (state) { var d = 'disabled' var $el = this.$element var val = $el.is('input') ? 'val' : 'html' var data = $el.data() state = state + 'Text' if (data.resetText == null) $el.data('resetText', $el[val]()) // push to event loop to allow forms to submit setTimeout($.proxy(function () { $el[val](data[state] == null ? this.options[state] : data[state]) if (state == 'loadingText') { this.isLoading = true $el.addClass(d).attr(d, d) } else if (this.isLoading) { this.isLoading = false $el.removeClass(d).removeAttr(d) } }, this), 0) } Button.prototype.toggle = function () { var changed = true var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { var $input = this.$element.find('input') if ($input.prop('type') == 'radio') { if ($input.prop('checked') && this.$element.hasClass('active')) changed = false else $parent.find('.active').removeClass('active') } if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') } else { this.$element.attr('aria-pressed', !this.$element.hasClass('active')) } if (changed) this.$element.toggleClass('active') } // BUTTON PLUGIN DEFINITION // ======================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.button') var options = typeof option == 'object' && option if (!data) $this.data('bs.button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } var old = $.fn.button $.fn.button = Plugin $.fn.button.Constructor = Button // BUTTON NO CONFLICT // ================== $.fn.button.noConflict = function () { $.fn.button = old return this } // BUTTON DATA-API // =============== $(document) .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') Plugin.call($btn, 'toggle') e.preventDefault() }) .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) }) }(jQuery); /* ======================================================================== * Bootstrap: carousel.js v3.3.4 * http://getbootstrap.com/javascript/#carousel * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CAROUSEL CLASS DEFINITION // ========================= var Carousel = function (element, options) { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.paused = null this.sliding = null this.interval = null this.$active = null this.$items = null this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) } Carousel.VERSION = '3.3.4' Carousel.TRANSITION_DURATION = 600 Carousel.DEFAULTS = { interval: 5000, pause: 'hover', wrap: true, keyboard: true } Carousel.prototype.keydown = function (e) { if (/input|textarea/i.test(e.target.tagName)) return switch (e.which) { case 37: this.prev(); break case 39: this.next(); break default: return } e.preventDefault() } Carousel.prototype.cycle = function (e) { e || (this.paused = false) this.interval && clearInterval(this.interval) this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } Carousel.prototype.getItemIndex = function (item) { this.$items = item.parent().children('.item') return this.$items.index(item || this.$active) } Carousel.prototype.getItemForDirection = function (direction, active) { var activeIndex = this.getItemIndex(active) var willWrap = (direction == 'prev' && activeIndex === 0) || (direction == 'next' && activeIndex == (this.$items.length - 1)) if (willWrap && !this.options.wrap) return active var delta = direction == 'prev' ? -1 : 1 var itemIndex = (activeIndex + delta) % this.$items.length return this.$items.eq(itemIndex) } Carousel.prototype.to = function (pos) { var that = this var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" if (activeIndex == pos) return this.pause().cycle() return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) } Carousel.prototype.pause = function (e) { e || (this.paused = true) if (this.$element.find('.next, .prev').length && $.support.transition) { this.$element.trigger($.support.transition.end) this.cycle(true) } this.interval = clearInterval(this.interval) return this } Carousel.prototype.next = function () { if (this.sliding) return return this.slide('next') } Carousel.prototype.prev = function () { if (this.sliding) return return this.slide('prev') } Carousel.prototype.slide = function (type, next) { var $active = this.$element.find('.item.active') var $next = next || this.getItemForDirection(type, $active) var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' var that = this if ($next.hasClass('active')) return (this.sliding = false) var relatedTarget = $next[0] var slideEvent = $.Event('slide.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) this.$element.trigger(slideEvent) if (slideEvent.isDefaultPrevented()) return this.sliding = true isCycling && this.pause() if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) $nextIndicator && $nextIndicator.addClass('active') } var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" if ($.support.transition && this.$element.hasClass('slide')) { $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) $active .one('bsTransitionEnd', function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger(slidEvent) }, 0) }) .emulateTransitionEnd(Carousel.TRANSITION_DURATION) } else { $active.removeClass('active') $next.addClass('active') this.sliding = false this.$element.trigger(slidEvent) } isCycling && this.cycle() return this } // CAROUSEL PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.carousel') var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) var action = typeof option == 'string' ? option : options.slide if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } var old = $.fn.carousel $.fn.carousel = Plugin $.fn.carousel.Constructor = Carousel // CAROUSEL NO CONFLICT // ==================== $.fn.carousel.noConflict = function () { $.fn.carousel = old return this } // CAROUSEL DATA-API // ================= var clickHandler = function (e) { var href var $this = $(this) var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 if (!$target.hasClass('carousel')) return var options = $.extend({}, $target.data(), $this.data()) var slideIndex = $this.attr('data-slide-to') if (slideIndex) options.interval = false Plugin.call($target, options) if (slideIndex) { $target.data('bs.carousel').to(slideIndex) } e.preventDefault() } $(document) .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) $(window).on('load', function () { $('[data-ride="carousel"]').each(function () { var $carousel = $(this) Plugin.call($carousel, $carousel.data()) }) }) }(jQuery); /* ======================================================================== * Bootstrap: collapse.js v3.3.4 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, Collapse.DEFAULTS, options) this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + '[data-toggle="collapse"][data-target="#' + element.id + '"]') this.transitioning = null if (this.options.parent) { this.$parent = this.getParent() } else { this.addAriaAndCollapsedClass(this.$element, this.$trigger) } if (this.options.toggle) this.toggle() } Collapse.VERSION = '3.3.4' Collapse.TRANSITION_DURATION = 350 Collapse.DEFAULTS = { toggle: true } Collapse.prototype.dimension = function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } Collapse.prototype.show = function () { if (this.transitioning || this.$element.hasClass('in')) return var activesData var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') if (actives && actives.length) { activesData = actives.data('bs.collapse') if (activesData && activesData.transitioning) return } var startEvent = $.Event('show.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return if (actives && actives.length) { Plugin.call(actives, 'hide') activesData || actives.data('bs.collapse', null) } var dimension = this.dimension() this.$element .removeClass('collapse') .addClass('collapsing')[dimension](0) .attr('aria-expanded', true) this.$trigger .removeClass('collapsed') .attr('aria-expanded', true) this.transitioning = 1 var complete = function () { this.$element .removeClass('collapsing') .addClass('collapse in')[dimension]('') this.transitioning = 0 this.$element .trigger('shown.bs.collapse') } if (!$.support.transition) return complete.call(this) var scrollSize = $.camelCase(['scroll', dimension].join('-')) this.$element .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) } Collapse.prototype.hide = function () { if (this.transitioning || !this.$element.hasClass('in')) return var startEvent = $.Event('hide.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return var dimension = this.dimension() this.$element[dimension](this.$element[dimension]())[0].offsetHeight this.$element .addClass('collapsing') .removeClass('collapse in') .attr('aria-expanded', false) this.$trigger .addClass('collapsed') .attr('aria-expanded', false) this.transitioning = 1 var complete = function () { this.transitioning = 0 this.$element .removeClass('collapsing') .addClass('collapse') .trigger('hidden.bs.collapse') } if (!$.support.transition) return complete.call(this) this.$element [dimension](0) .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION) } Collapse.prototype.toggle = function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } Collapse.prototype.getParent = function () { return $(this.options.parent) .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') .each($.proxy(function (i, element) { var $element = $(element) this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) }, this)) .end() } Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { var isOpen = $element.hasClass('in') $element.attr('aria-expanded', isOpen) $trigger .toggleClass('collapsed', !isOpen) .attr('aria-expanded', isOpen) } function getTargetFromTrigger($trigger) { var href var target = $trigger.attr('data-target') || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 return $(target) } // COLLAPSE PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.collapse $.fn.collapse = Plugin $.fn.collapse.Constructor = Collapse // COLLAPSE NO CONFLICT // ==================== $.fn.collapse.noConflict = function () { $.fn.collapse = old return this } // COLLAPSE DATA-API // ================= $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { var $this = $(this) if (!$this.attr('data-target')) e.preventDefault() var $target = getTargetFromTrigger($this) var data = $target.data('bs.collapse') var option = data ? 'toggle' : $this.data() Plugin.call($target, option) }) }(jQuery); /* ======================================================================== * Bootstrap: dropdown.js v3.3.4 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // DROPDOWN CLASS DEFINITION // ========================= var backdrop = '.dropdown-backdrop' var toggle = '[data-toggle="dropdown"]' var Dropdown = function (element) { $(element).on('click.bs.dropdown', this.toggle) } Dropdown.VERSION = '3.3.4' Dropdown.prototype.toggle = function (e) { var $this = $(this) if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') clearMenus() if (!isActive) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { // if mobile we use a backdrop because click events don't delegate $('