var PopularPhotoLoader = Class.create({ albums: [{"id":"27194","name":"\u041e\u0442\u043a\u0440\u044b\u0442\u043a\u0438 \u043a \u0420\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u0443 \u0425\u0440\u0438\u0441\u0442\u043e\u0432\u0430 \u2014 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432 2025 \u0433\u043e\u0434\u0443","url":"https:\/\/www.pravda.ru\/photo\/album\/27194\/","imgTag":"\"\u041e\u0442\u043a\u0440\u044b\u0442\u043a\u0438","photoCount":"8"},{"id":"27083","name":"\u0420\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0435 30 \u043d\u043e\u044f\u0431\u0440\u044f: \u0441\u0430\u0442\u0438\u0440\u0438\u043a\u0438","url":"https:\/\/www.pravda.ru\/photo\/album\/27083\/","imgTag":"\"\u0420\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0435","photoCount":"6"},{"id":"26630","name":"\u041f\u0435\u0440\u0432\u044b\u0435 \u0445\u043e\u0437\u044f\u0439\u043a\u0438 \u0411\u0435\u043b\u043e\u0433\u043e \u0434\u043e\u043c\u0430","url":"https:\/\/www.pravda.ru\/photo\/album\/26630\/","imgTag":"\"\u041f\u0435\u0440\u0432\u044b\u0435","photoCount":"7"},{"id":"27081","name":"\u0420\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0435 28 \u043d\u043e\u044f\u0431\u0440\u044f: \u043c\u044b\u0441\u043b\u0438\u0442\u0435\u043b\u0438","url":"https:\/\/www.pravda.ru\/photo\/album\/27081\/","imgTag":"\"\u0420\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0435","photoCount":"9"}], count: 5, horizontal: true, nodeId: 'gallery-id', newWindow: false, target: '_self', initialize: function(count, horizontal, nodeId, newWindow) { this.count = count; this.horizontal = horizontal; if (nodeId) this.nodeId = nodeId; if (newWindow) this.newWindow = newWindow; this.target = newWindow ? '_blank' : '_self'; this.render(); }, render: function() { var table = new Element('table', {'class' : 'frame', 'style' : 'width:100%;font-size:12px;'}); if (this.horizontal) var row = table.insertRow(-1); var limit = this.albums.length > this.count ? this.count : this.albums.length; this.albums.shuffle(); for (var i=0; i < limit; i++) { if (!this.horizontal) var row = table.insertRow(-1); var cell = row.insertCell(-1); cell.setAttribute('valign', 'top'); if (limit == 2) cell.setAttribute('style', 'width:50%'); if (i >= 1) cell.setAttribute('style', 'padding-top: 0px'); if (this.albums[i].imgTag) { var a = new Element('a', {'href' : this.albums[i].url, 'target' : this.target}); a.innerHTML = this.albums[i].imgTag; cell.appendChild(a); } var a = new Element('a', {'href' : this.albums[i].url, 'target' : this.target}); a.appendChild(document.createTextNode(this.albums[i].name)); cell.appendChild(a); cell.appendChild(new Element('br')); var a = new Element('a', {'href' : this.albums[i].url, 'class' : 'hot', 'target' : this.target}); a.appendChild(document.createTextNode('('+this.albums[i].photoCount+' фото)')); cell.appendChild(a); } $(this.nodeId).innerHTML = ''; $(this.nodeId).appendChild(table); } });