PageSourceSearch

https://portagemi.gov/assets/scripts/imagerepository.js

js portagemi.gov collected 2026-09-24 09:52:53 UTC 3,668 bytes, 86 lines download raw bytes

1function ImageRepositoryClass() {
2	this.loadSource = { Self: 0, Slideshow: 1, RelatedDocuments: 2, Design: 3, Content: 4, Banner: 5 };
3	this.$imageUploadModal = null;
4	this.imageID = 0;
5	this.options = { modalTitle: 'Images', targetID: 0, $target: null, callback: null, loadSource: this.loadSource.Content };
6}
7
8window.appModuleIds = Object.freeze({
9	PhotoGallery: 53,
10	NewsFlash: 1
11});
12
13function getIframeHeightInPixels(moduleId) {
14	if ((moduleId === appModuleIds.NewsFlash && window.self !== window.top)
15		|| moduleId === appModuleIds.PhotoGallery) {
16		return '475px';
17	} else {
18		return '600px';
19	}
20}
21
22ImageRepositoryClass.prototype.openImageUploadModal = function (options) {
23	var imageRepositoryInstance = window.imageRepository;
24	imageRepositoryInstance.options = options;
25	callbackfnDocumentCenter = options.callback;
26	var className = 'slideShowImages';
27	if (window.FeatureToggles.isActive("CMS.DocumentCenter.ReplaceTelerikTreeAndGridWithReact")) {
28		className += ' reactModal';
29	}
30	imageRepositoryInstance.$imageUploadModal = openCpModal({
31		title: options.modalTitle,
32		className: className,
33		isFrontEnd: false,
34		useIframe: true,
35		draggable: true,
36		iframeHeight: getIframeHeightInPixels(options.moduleID),
37		elementID: 'mvcModal2',
38		url: '/Admin/DocumentCenter/FolderForModal/Index?renderMode=1&loadSource=' + options.loadSource + '&requestingModuleID=' + options.moduleID
39	});
40
41	imageRepositoryInstance.$imageUploadModal.removeClass('newCP adminWrap cpPopOver admin');
42};
43
44ImageRepositoryClass.prototype.closeImageWidgetUploadModal = function (documentID) {
45	var imageRepositoryInstance = window.imageRepository;
46	imageRepositoryInstance.$imageUploadModal.hide();
47	if (documentID > 0) {
48		$.ajax({
49			url: '/ContentWidgets/ImageSave/Save?widgetID=' + imageRepositoryInstance.options.targetID + '&contentCollectionID=' + imageRepositoryInstance.options.contentCollection.ContentCollectionID,
50			type: 'POST',
51			data: { imageID: documentID },
52			success: function (response) {
53				if (response.ErrorMessage) {
54					alert(response.ErrorMessage);
55				} else {
56					if (imageRepositoryInstance.options.contentCollection.IsWorkingCopy || isWidgetUnderMegaMenu($('#divImage' + imageRepositoryInstance.options.targetID))) {
57						$('#divImage' + imageRepositoryInstance.options.targetID).html(response);
58						contentUpdated();
59					} else {
60						var contentContainerID = $('#divImage' + imageRepositoryInstance.options.targetID).parents('.pageContent').filter(':first').data('containerid');
61						ContentCollectionInstance.CurrentContentContainerIDs.push(contentContainerID);
62						imageRepositoryInstance.options.contentCollection.reloadContent();
63					}
64					if (!window.isRemoveSetHeights)
65						SetHeights();
66				}
67			}
68		});
69	}
70};
71
72ImageRepositoryClass.prototype.closeCustomWidgetImageUploadModal = function (documentID) {
73	var imageRepositoryInstance = window.imageRepository;
74	imageRepositoryInstance.$imageUploadModal.hide();
75	if (documentID > 0) {
76		var imagePath = '/ImageRepository/Document?documentID=' + documentID;
77		var $input = imageRepositoryInstance.options.$target.parent().find(".input1");
78		var $divInputImage = imageRepositoryInstance.options.$target.parent().find(".divInputImage");
79		var $deleteInputImage = imageRepositoryInstance.options.$target.parent().find(".deleteInputImage");
80		$input.val(imagePath + '|');
81		$divInputImage.html("<img id='imgPreview' src='" + imagePath + "'style='max-width:100%'  alt=''>");
82		imageRepositoryInstance.options.$target.hide();
83		imageRepositoryInstance.options.$target = null;
84		$deleteInputImage.show();
85	}
86};

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.