فهرست منبع

Remove unused code/file

sbkwgh 8 سال پیش
والد
کامیت
b1bcfba9cf
3فایلهای تغییر یافته به همراه1 افزوده شده و 106 حذف شده
  1. 1 18
      src/App.vue
  2. 0 84
      src/assets/js/flexBoxGridCorrect.js
  3. 0 4
      src/main.js

+ 1 - 18
src/App.vue

@@ -115,11 +115,8 @@
 	import FancyInput from './components/FancyInput'
 	import LoadingButton from './components/LoadingButton'
 	import NotificationButton from './components/NotificationButton'
-
-	import mapGetters from 'vuex'
-
+	
 	import AjaxErrorHandler from './assets/js/errorHandler'
-	let { addFlexBoxChildren } = require('./assets/js/flexBoxGridCorrect')
 
 	export default {
 		name: 'app',
@@ -182,20 +179,6 @@
 				return this.$store.state.meta.categories
 			}
 		},
-		watch: {
-			$route (to) {
-				if(to.path === '/') {
-					setTimeout(() => {
-						addFlexBoxChildren('.index_categories', 'index_category');
-					}, 50);
-				}
-			},
-			categories () {
-				setTimeout(() => {
-					addFlexBoxChildren('.index_categories', 'index_category');
-				}, 50);
-			}
-		},
 		methods: {
 			showAccountModalTab (index) {
 				this.showAccountModal = true

+ 0 - 84
src/assets/js/flexBoxGridCorrect.js

@@ -1,84 +0,0 @@
-function removeHiddenFlexBoxChidren(parentString, childClass) {
-	var container = document.querySelector(parentString);
-	if(!container) return;
-
-	[].forEach.call(container.getElementsByClassName(childClass), function(el) {
-		if(el.style.visibility === 'hidden') {
-			container.removeChild(el);
-		}
-	});
-}
-
-function addFlexBoxChildren(parentString, childClass) {
-	var container = document.querySelector(parentString);
-	if(!container) return;
-
-	function getChildren() {
-		return [].map.call(container.getElementsByClassName(childClass), function(el) { return el; });
-	}
-	function lastTwoChildrenOnSameLine() {
-		var children = getChildren();
-
-		return (
-			children.slice(-1)[0].getBoundingClientRect().bottom ==
-			children.slice(-2)[0].getBoundingClientRect().bottom
-		);
-	}
-	function addChild() {
-		var div = document.createElement('div');
-		var child = getChildren()[0];
-		
-		div.classList.add(childClass);
-		div.style.visibility = 'hidden';
-
-		if(child && child.attributes[0].name.includes('data-v-')) {
-			div.setAttribute(child.attributes[0].name, '');
-		}
-	
-
-		container.appendChild(div);
-	}
-
-	//If there are no divs
-	if(!getChildren().length) return;
-
-	//Since there is only one div on the last line therefore
-	//Add another one to allow for the next comparison
-	if(!lastTwoChildrenOnSameLine()) {
-		addChild();
-	}
-
-	//Keep adding invisible div's until the last div and
-	//and the penunltimate div are on different lines
-	while (lastTwoChildrenOnSameLine()) {
-		addChild();
-	}
-
-	//Then remove last (additional) div
-	var children = getChildren();
-	if(children.slice(-1)[0].style.visibility === 'hidden') {
-		container.removeChild(children.slice(-1)[0]);
-	}
-	
-}
-
-var onResize = function(parentString, childClass) {
-	addFlexBoxChildren(parentString, childClass);
-
-	var ticking = false;
-	window.addEventListener('resize', function() {
-		if(ticking) return;
-		setTimeout(function() {
-			removeHiddenFlexBoxChidren(parentString, childClass);
-			addFlexBoxChildren(parentString, childClass);
-
-			ticking = false;
-		}, 10);
-		ticking = true;
-	});
-}
-
-module.exports = {
-	onResize,
-	addFlexBoxChildren
-}

+ 0 - 4
src/main.js

@@ -31,10 +31,6 @@ import AdminModerationReports from './components/routes/AdminModerationReports'
 import AdminModerationBannedUsers from './components/routes/AdminModerationBannedUsers'
 import AdminGeneral from './components/routes/AdminGeneral'
 
-let { onResize } = require('./assets/js/flexBoxGridCorrect.js')
-
-onResize('.index_categories', 'index_category');
-
 Vue.use(VueRouter)
 Vue.use(Vuex)
 Vue.use(VueAxios, axios)