PageSourceSearch

https://shop.runningcompany.com/assets/admin/scripts/models/brand.js?v=1.2.0

js runningcompany.com collected 2026-09-26 05:07:17 UTC 4,365 bytes, 168 lines download raw bytes

1
2var brand = {
3	data: [],
4	filter: {
5		search: "",
6		size: 50, 
7		page: 1,
8		sort: "name",
9		sortType: "asc"
10	},
11	get: function() {
12		service.call("brands", brand.filter, brand.returned);
13	},
14	all: function() {
15		var params = Object.assign({}, brand.filter);
16		params.size = 100000;
17		service.call("brands", params, brand.allReturned);
18		//brand.get();
19	},
20	allReturned: function(e) {
21		if (e.error) growler.error(e.error);
22		else context.set("allbrands", e.data);
23	},
24	returned: function(e) {
25		if (e.error) growler.error(e.error);
26		else {
27			brand.data = e.data;
28			brand.total = e.total;
29			var contextId = "brands";
30			if (brand.filter.admin!=null&&brand.filter.admin==true) contextId = "admin"+contextId;
31			context.set(contextId, brand.data);
32		}
33	},
34	move: function(id, to) {
35		var params = brand.filter;
36		params.id = id;
37		params.to = to;
38		service.call("brandToBrand", params, brand.returned);
39	},
40	delete: function(id) {
41		context.remove("brands");
42		var params = brand.filter;
43		var ids = [];
44		ids.push(id);
45		params.ids = ids;
46		service.call("brand", params,brand.returned,"DELETE");
47	},
48	details: function(id) {
49		if (brand.filter.admin!=null&&brand.filter.admin==true) brand.data = context.get("adminbrands");
50		else brand.data = context.get("brands");
51		for (var i=0; i<brand.data.length; i++) {
52			if (brand.data[i].brandId==id) return brand.data[i];
53		}
54		return null;
55	},
56	next: function() {
57		if (!isLast()) brand.filter.page++;
58		else brand.filter.page = 1;
59		brand.get();
60	},
61	prev: function() {
62		if (brand.filter.page>1) brand.filter.page--;
63		else brand.filter.page = Math.ceil(brand.total/brand.filter.size);
64		brand.get();
65	},
66	isLast: function() {
67		return (brand.total<=(brand.filter.page*brand.filter.size));
68	},
69	isFirst: function() {
70		return brand.filter.page==1;
71	},
72	pageTotal: function() {
73		return Math.ceil(brand.total/brand.filter.size);
74	},
75	goto: function(page) {
76		if (page<=brand.pageTotal()&&page>=1) {
77			brand.filter.page = page;
78			brand.get();
79		} 
80	},
81	saveReview: function(productId, userName, reviewText, reviewDate, stars, callback) {
82		var params = {};
83		params.productId = productId;
84		params.stars = stars;
85		params.message = reviewText;
86		params.userName = userName;
87		params.reviewDate = reviewDate;
88		service.call("review", params, callback);
89	},
90	getReviews: function(productId, callback) {
91		var params = {};
92		params.productId = productId;
93		service.call("product/reviews", params, callback);
94	},
95	approveReview: function(reviewId, callback) {
96		var params = {
97			reviewId: reviewId,
98			isApproved: true,
99			total: 100,
100			page: 0,
101			search: "",
102			sort: "datePosted",
103			sortType: "DESC"
104		}
105		service.call("review/toggle", params, callback);
106	},
107	bulkApprove: function(reviewIds, callback) {
108		var params = {
109			reviewIds: reviewIds,
110			isApproved: true,
111			total: 100,
112			page: 0,
113			search: "",
114			sort: "datePosted",
115			sortType: "DESC"
116		}
117		service.call("review/bulkToggle", params, callback);
118	},
119	bulkDelete: function(reviewId, callback) {
120		var params = {
121			reviewIds: reviewId,
122			isApproved: true,
123			total: 100,
124			page: 0,
125			search: "",
126			sort: "datePosted",
127			sortType: "DESC"
128		}
129		service.call("review/delete", params, callback);
130	},
131	getReviewsAdmin: function(isApproved = false, callback) {
132		var params = {
133			total: 100,
134			page: 0,
135			search: "",
136			sort: "datePosted",
137			sortType: "DESC",
138			isApproved: isApproved
139		}
140		service.call("reviews", params, callback);
141	},
142	deleteReviews: function(reviewIds, isApproved, callback) {
143		var params = {
144			total: 100,
145			page: 0,
146			search: "",
147			sort: "datePosted",
148			sortType: "DESC",
149			reviewIds: reviewIds,
150			isApproved: isApproved
151		}
152		service.call("reviews/delete", params, callback);
153	},
154	save: function(name, label, isInStore, inStoreSalesOnly, title, tags, description, relayId, id) {
155		context.remove("brands");
156		var params = brand.filter;
157		params.id = id; 
158		params.name = name;
159		params.label = label;
160		params.title = title;
161		params.tags = tags;
162		params.relayId = relayId;
163		params.description = description;
164		params.isInStore = isInStore;
165		params.inStoreSalesOnly = inStoreSalesOnly;
166		service.call("brand", params, brand.returned);
167	}
168}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.