PageSourceSearch

https://www.mobilissimo.ro/js/app/page/app.Page.viewArticle.js?v=20260603-gallery-inp-v3

js mobilissimo.ro collected 2026-10-02 07:44:29 UTC 7,764 bytes, 276 lines download raw bytes

1if (typeof app == 'undefined')
2{
3	var app = {};
4}
5if (typeof app.Page == 'undefined')
6{
7	app.Page = {};
8}
9
10app.Page.viewArticle = {
11	_unifiedArticleGallery : null,
12	_articleGalleryRails : [],
13
14	useLegacyArticleGallery : function()
15	{
16		var oConfig = window.mbDesktopArticleGalleryConfig || {};
17
18		return !(oConfig.isDesktopArticlePage && oConfig.mode === 'mobile-overlay');
19	},
20
21	initUnifiedArticleGallery : function()
22	{
23		if (this.useLegacyArticleGallery() || typeof app.articleGalleryOverlayFactory == 'undefined')
24		{
25			return;
26		}
27
28		app.articleGalleryOverlaySupport.prepareArticleImages({
29			articleSelector : '#article',
30			bodyImageSelector : '[itemprop="articleBody"] img'
31		});
32		app.articleGalleryStreamSupport.primeArticleImageStream($('#article'), {
33			articleEntrySelector : '.articleHeroMedia a.ui-action-fancybox, .mainPhoto > a.ui-action-fancybox, [itemprop="articleBody"] a.ui-action-fancybox, [itemprop="articleBody"] a.ui-action-gallery-overlay'
34		});
35
36		if (!this._unifiedArticleGallery)
37		{
38			this._unifiedArticleGallery = app.articleGalleryOverlayFactory.create({
39				enabled : true,
40				scopeSelector : '#article',
41				articleSelector : '#article',
42				fancyboxTriggerSelector : '.ui-action-fancybox',
43				galleryTriggerSelector : '.ui-action-gallery-overlay',
44				articleEntrySelector : '.articleHeroMedia a.ui-action-fancybox, .mainPhoto > a.ui-action-fancybox, [itemprop="articleBody"] a.ui-action-fancybox, [itemprop="articleBody"] a.ui-action-gallery-overlay',
45				bodyOpenClass : 'ui-gallery-open',
46				photoSwipeMainClass : 'pswp--mobilissimo',
47				closeIconHtml : '<i class="pswp__icn pswp__fa-icon fas fa-times" aria-hidden="true"></i>',
48				prevIconHtml : '<i class="pswp__icn pswp__fa-icon fal fa-arrow-left" aria-hidden="true"></i>',
49				nextIconHtml : '<i class="pswp__icn pswp__fa-icon fal fa-arrow-right" aria-hidden="true"></i>'
50			});
51			this._unifiedArticleGallery.init();
52		}
53	},
54
55	initArticleGalleryThumbRail : function()
56	{
57		var self = this;
58
59		if (
60			this.useLegacyArticleGallery() ||
61			typeof app.articleGalleryRailFactory == 'undefined' ||
62			!$('.js-article-gallery-rail').length
63		)
64		{
65			return;
66		}
67
68		this._articleGalleryRails = [];
69		$('.js-article-gallery-rail').each(function(i, el) {
70			var $rail = $(el),
71				sScope = $.trim($rail.attr('data-gallery-rail-scope') ? $rail.attr('data-gallery-rail-scope') : ''),
72				nGalleryId = parseInt($rail.attr('data-photo-gallery-id'), 10) || 0,
73				oRail = app.articleGalleryRailFactory.create({
74					enabled : true,
75					articleSelector : '#article',
76					railRoot : el,
77					articleEntrySelector : app.articleGalleryStreamSupport.getDefaultArticleEntrySelector(),
78					scope : sScope ? sScope : 'article',
79					galleryId : nGalleryId,
80					overlay : self._unifiedArticleGallery
81				});
82
83			self._articleGalleryRails.push(oRail);
84			oRail.init();
85		});
86	},
87
88	init: function() {
89		var self = this;
90
91		if (!$('#articleWrapper').length)
92		{
93			return;
94		}
95
96		$('#articleLoadMoreArticles').on('click', function(e) {
97			e.preventDefault();
98
99			var $oLink  = $(this),
100				$oLabel = $oLink.find('i');
101
102			if ($oLink.hasClass('expand'))
103			{
104				$oLink.removeClass('expand').addClass('contract');
105				$oLabel.html("ÎNCHIDE");
106			}
107			else
108			{
109				$oLink.removeClass('contract').addClass('expand');
110				$oLabel.html("EXTINDE");
111			}
112		});
113
114		$('[data-source-type]').each(function() {
115			if (!$(this).find('a').length)
116			{
117				$(this).remove();
118			}
119		});
120
121		$('.reviewPagination a').mouseenter(function(e) {
122			if ($(e.target).attr('data-title-target'))
123			{
124				var $target = $($(e.target).attr('data-title-target'));
125				$target.html($(e.target).attr('data-title-content'));
126				$target.parent().addClass('active');
127			}
128		});
129
130		$('.reviewPagination a').mouseleave(function(e) {
131			if ($(e.target).attr('data-title-target'))
132			{
133				var $target = $($(e.target).attr('data-title-target'));
134				$target.html($target.attr('data-title'));
135				$target.parent().removeClass('active');
136			}
137		});
138
139		if (self.useLegacyArticleGallery())
140		{
141			$('[data-carousel-id]').each(function(e, el) {
142				$(el).jcarousel();
143				self.postLoadVisibleCarouselImages($(el));
144			});
145			$('.carousel-nav-prev[data-carousel]').on('click', function(e) {
146				e.preventDefault();
147				var targetCarousel = $(this).attr('data-carousel'),
148					$oPrev = $('.carousel-control [data-carousel-id=' + targetCarousel + ']').find('.active').prev(),
149					$oCurrent = $('.carousel-control [data-carousel-id=' + targetCarousel + ']').find('.active');
150				$('[data-carousel-id="' + targetCarousel + '"]').each(function (i, el) {
151					$(el).jcarousel('scroll', '-=1', function() {
152						self.postLoadVisibleCarouselImages($(el));
153					});
154				});
155				if ($oPrev.length)
156				{
157					$oCurrent.removeClass('active');
158					$oPrev.addClass('active');
159				}
160			});
161			$('.carousel-nav-next[data-carousel]').on('click', function(e) {
162				e.preventDefault();
163				var targetCarousel = $(this).attr('data-carousel'),
164					$oNext = $('.carousel-control [data-carousel-id=' + targetCarousel + ']').find('.active').next(),
165					$oCurrent = $('.carousel-control [data-carousel-id=' + targetCarousel + ']').find('.active');
166				$('[data-carousel-id="' + targetCarousel + '"]').each(function(i, el) {
167					$(el).jcarousel('scroll', '+=1', function() {
168						self.postLoadVisibleCarouselImages($(el));
169					});
170				});
171				if ($oNext.length)
172				{
173					$oCurrent.removeClass('active');
174					$oNext.addClass('active');
175				}
176			});
177			$('[data-carousel-position]').on('click', function(e) {
178				e.preventDefault();
179
180				var targetCarousel = $(this).attr('data-carousel'),
181					position = $(this).attr('data-carousel-position');
182
183				$('[data-carousel-id="' + targetCarousel + '"]').each(function (i, el) {
184					$(el).jcarousel('scroll', position, function() {
185						self.postLoadVisibleCarouselImages($(el));
186					});
187
188				});
189
190				$(this).siblings('.active').removeClass('active');
191				$(this).addClass('active');
192			});
193		}
194		else
195		{
196			self.initUnifiedArticleGallery();
197			self.initArticleGalleryThumbRail();
198		}
199		self.strech500pxImages();
200		self.saveArticle();
201	},
202
203	postLoadCarouselImage : function($el)
204	{
205		if (!$el || !$el.length || !$el.attr('data-src'))
206		{
207			return;
208		}
209
210		var $img  = $('<img />').attr('src', $el.attr('data-src'));
211		$img.on('load', function() {
212			$el.after($img);
213			$el.remove();
214		});
215	},
216
217	postLoadVisibleCarouselImages : function($carousel)
218	{
219		var self = this;
220
221		if (!$carousel || !$carousel.length)
222		{
223			return;
224		}
225
226		$carousel.jcarousel('visible').each(function(i, el) {
227			var $placeholder = $(el).find('span[data-src]');
228
229			if ($placeholder.length)
230			{
231				self.postLoadCarouselImage($placeholder);
232			}
233		});
234	},
235
236	strech500pxImages : function()
237	{
238		var self = this,
239			$article = $('article');
240
241		$article.find('img').each(function(i, el) {
242			var $img = $(el);
243			if ($img.css('width') == '500px')
244			{
245				$img.removeAttr('style');
246				$img.css('width', '592px');
247			}
248		});
249
250		$article.find('iframe').each(function(i, el) {
251			var $iframe = $(el),
252				youtubeTest = /https?:\/\/www.youtube\.com\/embed\/.+/;
253			if (youtubeTest.test($iframe.prop('src')))
254			{
255				$iframe.prop('width', '592').prop('height', '347');
256			}
257		});
258	},
259
260	saveArticle : function()
261	{
262		$(document).on('click', '.ui-action-save-article-event', function(e) {
263			var $el = $(e.target).hasClass('ui-action-save-article-event') ? $(e.target) : $(e.target).parents('.ui-action-save-article-event');
264			$.get($el.attr('data-endpoint'), function(response) {
265				if (response.status == 1)
266				{
267					$el.addClass('disabled').find('em').html('Articol salvat');
268				}
269				else if (response.status == -1)
270				{
271					$('.ui-action-overlay.ui-action-login.login').click();
272				}
273			}, 'json');
274		});
275	}
276}

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.