/** * @see cron/import_readable_article.php * требуется firstReadableArticleContainer и readableArticleContainer */ function chooseReadableLayer(tag) { if (tag.parentNode.getAttribute(document.all ? "className" : "class") && tag.parentNode.getAttribute(document.all ? "className" : "class") == 'active' ) return false; tag.parentNode.className = "active"; for(var i = 0; i < tag.parentNode.parentNode.childNodes.length; i++) { if (typeof tag.parentNode.parentNode.childNodes[i].tagName != 'undefined' && tag.parentNode.parentNode.childNodes[i].tagName.toLowerCase() == 'li' && tag.parentNode.getAttribute('rid') != tag.parentNode.parentNode.childNodes[i].getAttribute('rid') ) { tag.parentNode.parentNode.childNodes[i].className = ""; } } showReadableArticlesByRubric(tag.parentNode.getAttribute('rid')); return true; } function showReadableArticlesByRubric(rubricId) { var articles = readableArticleListByRubric.findAll(function(item) { return item.rubricId == rubricId; }) // Выбор редакции // if (rubricId == 0) { // $('firstReadableArticleContainer').innerHTML = ''; // $('readableArticleContainer').innerHTML = ''; // // for (var i = 0; i < articles.length; i++) { // var img = new Element('img', {'src': articles[i].img, 'alt': articles[i].title, 'title': articles[i].title}); // var a = new Element('a', {'href': articles[i].url}).update(articles[i].title); // // var aimg = new Element('a', {'href': articles[i].url}); // aimg.appendChild(img); // // var li = new Element('li', {'style':'background:none;'}); // // li.appendChild(aimg); // li.appendChild(a); // // $('readableArticleContainer').appendChild(li); // } // // return true; // } // 1. $('firstReadableArticleContainer').innerHTML = ''; var img = new Element('img', {'src': articles[0].img, 'alt': articles[0].title, 'title': articles[0].title, 'width':'82', 'height': '62'}); var a = new Element('a', {'href': articles[0].url}).update(articles[0].title); var aimg = new Element('a', {'href': articles[0].url}); aimg.appendChild(img); $('firstReadableArticleContainer').appendChild(aimg); $('firstReadableArticleContainer').appendChild(a); // 2. $('readableArticleContainer').innerHTML = ''; for (var i = 1; i < articles.length; i++) { var a = new Element('a', {'href': articles[i].url}).update(articles[i].title); var li = new Element('li'); if (i%2) li.addClassName('d') li.appendChild(a); $('readableArticleContainer').appendChild(li); } return true; } var readableRubricList = []; var readableArticleListByRubric = [];