apostila Arquivo Calendário

download apostila Arquivo Calendário

If you can't read please download the document

description

código para widget

Transcript of apostila Arquivo Calendário

//var bcLoadingImage = "http://lh3.ggpht.com/_UCfxgWHzU98/S57-pjOiY1I/AAAAAAAACSQ/7IQnYLIn2hU/loading.gif";var bcLoadingMessage = " Carregando....";var bcArchiveNavText = "Ver Posts em Arquivos ";var bcArchiveNavPrev = '';var bcArchiveNavNext = '';var headDays = ["Domingo","Segunda","Tera","Quarta","Quinta","Sexta","Sbado"];var headInitial = ["Dom","Seg","Ter","Qua","Qui","Sex","Sab"];// Nothing to configure past this point ----------------------------------var timeOffset;var bcBlogID;var calMonth;var calDay = 1;var calYear;var startIndex;var callmth;var bcNav = new Array ();var bcList = new Array ();//Initialize Fill Arrayvar fill = ["","31","28","31","30","31","30","31","31","30","31","30","31"];function openStatus(){document.getElementById('calLoadingStatus').style.display = 'block';document.getElementById('calendarDisplay').innerHTML = '';}function closeStatus(){document.getElementById('calLoadingStatus').style.display = 'none';}function bcLoadStatus(){cls = document.getElementById('calLoadingStatus');img = document.createElement('img');img.src = bcLoadingImage;img.style.verticalAlign = 'middle';cls.appendChild(img);txt = document.createTextNode(bcLoadingMessage);cls.appendChild(txt);}function callArchive(mth,yr,nav){// Check for Leap Yearsif (((yr % 4 == 0) && (yr % 100 != 0)) || (yr % 400 == 0)) {fill[2] = '29';}else {fill[2] = '28';}calMonth = mth;calYear = yr;if(mth.charAt(0) == 0){calMonth = mth.substring(1);}callmth = mth;bcNavAll = document.getElementById('bcFootAll');bcNavPrev = document.getElementById('bcFootPrev');bcNavNext = document.getElementById('bcFootNext');bcSelect = document.getElementById('bcSelection');a = document.createElement('a');at = document.createTextNode(bcArchiveNavText);a.href = bcNav[nav];a.appendChild(at);bcNavAll.innerHTML = '';bcNavAll.appendChild(a);bcNavPrev.innerHTML = '';bcNavNext.innerHTML = '';if(nav < bcNav.length -1){a = document.createElement('a');a.innerHTML = bcArchiveNavPrev;bcp = parseInt(nav,10) + 1;a.href = bcNav[bcp];a.title = 'Previous Archive';prevSplit = bcList[bcp].split(',');a.onclick = function(){bcSelect.options[bcp].selected = true;openStatus();callArchive(prevSplit[0],prevSplit[1],prevSplit[2]);return false;};bcNavPrev.appendChild(a);}if(nav > 0){a = document.createElement('a');a.innerHTML = bcArchiveNavNext;bcn = parseInt(nav,10) - 1;a.href = bcNav[bcn];a.title = 'Next Archive';nextSplit = bcList[bcn].split(',');a.onclick = function(){bcSelect.options[bcn].selected = true;openStatus();callArchive(nextSplit[0],nextSplit[1],nextSplit[2]);return false;};bcNavNext.appendChild(a);}script = document.createElement('script');script.src = 'http://www.blogger.com/feeds/'+bcBlogId+'/posts/summary?published-max='+calYear+'-'+callmth+'-'+fill[calMonth]+'T23%3A59%3A59'+timeOffset+'&published-min='+calYear+'-'+callmth+'-01T00%3A00%3A00'+timeOffset+'&max-results=100&orderby=published&alt=json-in-script&callback=cReadArchive';document.getElementsByTagName('head')[0].appendChild(script);}function cReadArchive(root){// Check for Leap Yearsif (((calYear % 4 == 0) && (calYear % 100 != 0)) || (calYear % 400 == 0)) {fill[2] = '29';}else {fill[2] = '28';}closeStatus();document.getElementById('lastRow').style.display = 'none';calDis = document.getElementById('calendarDisplay');var feed = root.feed;var total = feed.openSearch$totalResults.$t;var entries = feed.entry || [];var fillDate = new Array();var fillTitles = new Array();fillTitles.length = 32;var ul = document.createElement('ul');ul.id = 'calendarUl';for (var i = 0; i < feed.entry.length; ++i) {var entry = feed.entry[i];for (var j = 0; j < entry.link.length; ++j) {if (entry.link[j].rel == "alternate") {var link = entry.link[j].href;}}var title = entry.title.$t;var author = entry.author[0].name.$t;var date = entry.published.$t;var summary = entry.summary.$t;isPublished = date.split('T')[0].split('-')[2];if(isPublished.charAt(0) == '0'){isPublished = isPublished.substring(1);}fillDate.push(isPublished);if (fillTitles[isPublished]){fillTitles[isPublished] = fillTitles[isPublished] + ' | ' + title;}else {fillTitles[isPublished] = title;}li = document.createElement('li');li.style.listType = 'none';li.innerHTML = ''+title+'';ul.appendChild(li);}calDis.appendChild(ul);var val1 = parseInt(calDay, 10)var valxx = parseInt(calMonth, 10);var val2 = valxx - 1;var val3 = parseInt(calYear, 10);var firstCalDay = new Date(val3,val2,1);var val0 = firstCalDay.getDay();startIndex = val0 + 1;var dayCount = 1;for (x =1; x < 38; x++){var cell = document.getElementById('cell'+x);if( x < startIndex){cell.innerHTML = ' ';cell.className = 'firstCell';}if( x >= startIndex){cell.innerHTML = dayCount;cell.className = 'filledCell';for(p = 0; p < fillDate.length; p++){if(dayCount == fillDate[p]){if(fillDate[p].length == 1){fillURL = '0'+fillDate[p];}else {fillURL = fillDate[p];}cell.className = 'highlightCell';cell.innerHTML = '