var KIRBY_WIKI_GLOBAL=KIRBY_WIKI_GLOBAL||{};var hasClass=(function(){var reCache={};return function(element,className){return(reCache[className]?reCache[className]:(reCache[className]=new RegExp("(?:\\s|^)"+className+"(?:\\s|$)"))).test(element.className);};})();var autoCollapse=2;var collapseCaption="hide";var expandCaption="show";function collapseTable(tableIndex){var Button=document.getElementById("collapseButton"+tableIndex);var Table=document.getElementById("collapsibleTable"+tableIndex);if(!Table||!Button){return false;}var Rows=Table.rows;if(Button.firstChild.data==collapseCaption){for(var i=1;i<Rows.length;i++){Rows[i].style.display="none";}Button.firstChild.data=expandCaption;}else{for(var i=1;i<Rows.length;i++){Rows[i].style.display=Rows[0].style.display;}Button.firstChild.data=collapseCaption;}}function createCollapseButtons(){var tableIndex=0;var NavigationBoxes=new Object();var Tables=document.getElementsByTagName("table");for(var i=0;i<Tables.length;i++){if(hasClass(
Tables[i],"collapsible")){var HeaderRow=Tables[i].getElementsByTagName("tr")[0];if(!HeaderRow)continue;var Header=HeaderRow.getElementsByTagName("th")[0];if(!Header)continue;NavigationBoxes[tableIndex]=Tables[i];Tables[i].setAttribute("id","collapsibleTable"+tableIndex);var Button=document.createElement("span");var ButtonLink=document.createElement("a");var ButtonText=document.createTextNode(collapseCaption);Button.style.styleFloat="right";Button.style.cssFloat="right";Button.style.fontWeight="normal";Button.style.textAlign="right";Button.style.width="6em";ButtonLink.style.color=Header.style.color;ButtonLink.setAttribute("id","collapseButton"+tableIndex);ButtonLink.setAttribute("href","javascript:collapseTable("+tableIndex+");");ButtonLink.appendChild(ButtonText);Button.appendChild(document.createTextNode("["));Button.appendChild(ButtonLink);Button.appendChild(document.createTextNode("]"));Header.insertBefore(Button,Header.childNodes[0]);tableIndex++;}}for(var i=0;i<tableIndex;i++){if(
hasClass(NavigationBoxes[i],"collapsed")||(tableIndex>=autoCollapse&&hasClass(NavigationBoxes[i],"autocollapse"))){collapseTable(i);}}}addOnloadHook(createCollapseButtons);function loadYtPlayerAPI(){var tag=document.createElement('script');tag.src='http://www.youtube.com/iframe_api';tag.type='text/javascript';var firstScriptTag=document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);}addOnloadHook(loadYtPlayerAPI);function initYoutubePlaylistPlayers(){var WIKI_PREFIX='kw',PLAYER_POSTFIX='-ytplaylistplayer',INNER_WRAPER_POSTFIX='-ytplaylistplayer-inner-wrapper',PLAYLIST_POSTFIX='-ytplaylistplayer-playlist',PLAYLIST_NOTICE_POSTFIX='-ytplaylistplayer-notice',PLAYLIST_ROW='-playlist-row-',PLAYLIST_INDEX='-playlist-index-',PLAYLIST_TITLE='-playlist-title-',PLAYLIST_CONTROL='-playlist-controls-',PLAYLIST_DURATION='-playlist-duration-',PLAYLIST_DESCRIPTION='-playlist-description-';var MAX_RESULTS=50,MAX_TRACK_LENGTH_EXPONENT=5;var iframeArray=$(
'iframe'+'.'+WIKI_PREFIX+PLAYER_POSTFIX),kwId,playlistId,iframe;function KwYoutubePlaylistPlayer(kwId,playlistId,iframe){var playlistLength=0,playlistDuration=0,playlistId;function init(){var startIndex=1;function getFeed(startIndex){function appendControls(parent,index){var playButton,playButtonInner,pauseButton,pauseButtonInner;playButtonInner=$('<img></img>');playButtonInner.attr({src:'http://images3.wikia.nocookie.net/kirby/en/images/a/a2/Playback-play-small.png',alt:'Play'});playButton=$('<a></a>');playButton.append(playButtonInner);playButton.click(function(){iframe.contentWindow.postMessage(JSON.stringify({event:'command',id:kwId,func:'playVideoAt',args:[index]}),'*');});pauseButtonInner=$('<img></img>');pauseButtonInner.attr({src:'http://images.wikia.com/kirby/en/images/9/96/Playback-pause-small.png',alt:'Pause'});pauseButton=$('<a></a>');pauseButton.append(pauseButtonInner);pauseButton.click(function(){iframe.contentWindow.postMessage(JSON.stringify({event:'command',id:kwId,
func:'pauseVideo',args:[]}),'*');});parent.append(playButton);parent.append(pauseButton);}function appendPlaylistDetails(data){var indexCell,titleCell,controlsCell,durationCell,descCell,titleAnchorElement,throbberElement;indexCell=$('#'+kwId+PLAYLIST_INDEX+'0');indexCell.append('P');titleCell=$('#'+kwId+PLAYLIST_TITLE+'0');titleAnchorElement=$('<a></a>');titleAnchorElement.html(data.feed.title.$t);titleAnchorElement.attr({id:'PL'+data.feed['yt$playlistId'].$t,href:'http://www.youtube.com/playlist?list='+'PL'+data.feed['yt$playlistId'].$t,target:'_blank'});titleCell.append(titleAnchorElement);controlsCell=$('#'+kwId+PLAYLIST_CONTROL+'0');appendControls(controlsCell,0);durationCell=$('#'+kwId+PLAYLIST_DURATION+'0');throbberElement=$('<img></img>');throbberElement.attr({src:'http://images1.wikia.nocookie.net/kirby/en/images/8/82/Basic_throbber.gif',title:'Remaining data is still loading... Please wait.',alt:'Basic throbber.gif'});durationCell.append(throbberElement);descCell=$('#'+kwId+
PLAYLIST_DESCRIPTION+'0');descCell.append(' ('+data.feed['openSearch$totalResults'].$t+' tracks)');}function appendTrackDetails(data,startIndex){$.each(data.feed.entry,function(i,v){var index=startIndex.toString();var tr=$('#'+kwId+PLAYLIST_ROW+index),prevTr=$('#'+kwId+PLAYLIST_ROW+(startIndex-1).toString()),indexCell,titleCell,controlsCell,durationCell;var emptyRow='<tr id="'+kwId+PLAYLIST_ROW+index+'">'+'<td id="'+kwId+PLAYLIST_INDEX+index+'"></td>'+'<td id="'+kwId+PLAYLIST_TITLE+index+'"></td>'+'<td id="'+kwId+PLAYLIST_CONTROL+index+'"></td>'+'<td id="'+kwId+PLAYLIST_DURATION+index+'"></td>'+'<td id="'+kwId+PLAYLIST_DESCRIPTION+index+'"></td>'+'</tr>';if(tr.length===0){$(prevTr).after(emptyRow);}else{tr.show();}indexCell=$('#'+kwId+PLAYLIST_INDEX+startIndex);indexCell.append('<span class="kw-sortkey">'+padTime(index,4)+'</span>'+index);var vidTitle,titleSubString,anchor;vidTitle=v.title.$t;titleSubString=vidTitle.substring(0,vidTitle.lastIndexOf("."));if(titleSubString!==''){
vidTitle=titleSubString;}anchor=$('<a></a>');anchor.html(vidTitle);anchor.addClass('external');anchor.attr({id:v['media$group']['yt$videoid'].$t,href:v['media$group']['media$player'].url,target:'_blank'});titleCell=$('#'+kwId+PLAYLIST_TITLE+index);titleCell.append(anchor);controlsCell=$('#'+kwId+PLAYLIST_CONTROL+index);appendControls(controlsCell,(startIndex-1));var trackDuration=v['media$group']['yt$duration'].seconds;KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer.players[kwId].playlistDuration+=parseInt(trackDuration);durationCell=$('#'+kwId+PLAYLIST_DURATION+index);durationCell.append('<span class="kw-sortkey">'+padTime(trackDuration,MAX_TRACK_LENGTH_EXPONENT)+'</span>');durationCell.append(secondsToClock(trackDuration));startIndex+=1;});}function finalizePlayer(){$('#'+kwId+PLAYLIST_DURATION+'0').html('<span class="kw-sortkey">'+padTime(KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer.players[kwId].playlistDuration,MAX_TRACK_LENGTH_EXPONENT)+'</span>'+secondsToClock(KIRBY_WIKI_GLOBAL.
youtubePlaylistPlayer.players[kwId].playlistDuration));var uriFragment=window.location.toString();if(uriFragment.lastIndexOf('#')!=-1){uriFragment=uriFragment.substring(uriFragment.lastIndexOf('#')+1);$('#'+uriFragment).parent().parent().addClass('playlist-highlight');document.getElementById(uriFragment).scrollIntoView(true);}}function secondsToClock(seconds){if(Math.floor(seconds/3600)>=1){return(Math.floor(seconds/3600)+':'+padTime(Math.floor(seconds/60)%60,2)+':'+padTime((seconds%60),2));}else{return(Math.floor(seconds/60)+':'+padTime((seconds%60),2));}}function padTime(input,length){var str=input.toString();while(str.length<length){str='0'+str;}return str;}function onAjaxSuccess(data){if(startIndex===1){$('#'+kwId+PLAYLIST_NOTICE_POSTFIX).parent().remove();KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer.players[kwId].playlistLength=parseInt(data.feed['openSearch$totalResults'].$t);appendPlaylistDetails(data);}appendTrackDetails(data,startIndex);var overflow=startIndex+MAX_RESULTS;if(
overflow<KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer.players[kwId].playlistLength){getFeed(overflow);}else{finalizePlayer();}}var startIndex=startIndex||1;$.ajax({url:'http://gdata.youtube.com/feeds/api/playlists/'+playlistId+'?v=2&alt=json&max-results='+MAX_RESULTS.toString()+'&start-index='+startIndex.toString(),dataType:'jsonp',success:onAjaxSuccess});}$('#'+kwId+PLAYLIST_NOTICE_POSTFIX).parent().remove();getFeed();};return{init:init,playlistLength:playlistLength,playlistDuration:playlistDuration,playlistId:playlistId,kwId:kwId,iframe:iframe}}KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer=KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer||{players:{}};iframeArray.each(function(i,v){if($(this).prop('tagName')==='IFRAME'){kwId=$(this).parent().attr('data-kw-id');playlistId=$(this).attr('id');iframe=$(this)[0];iframe.contentWindow.postMessage(JSON.stringify({event:'listening',id:kwId}),'*');window.addEventListener('message',function(event){var YT_STATE_UNSTARTED=-1;var YT_STATE_ENDED=0;var YT_STATE_PLAYING
=1;var YT_STATE_PAUSED=2;var YT_STATE_BUFFERING=3;var YT_STATE_CUED=5;if(event.source===iframe.contentWindow){var data=JSON.parse(event.data);var kwId;var playerState;var playlistIndex;var trackId;var playerRowElement;var kwPlayer;kwId=data.id;if(data.info!==null){if(data.info.playerState!==undefined){playerState=data.info.playerState;playlistIndex=data.info.playlistIndex;trackId=data.info.videoData.video_id;playerRowElement=$('#'+trackId).parent().parent();kwPlayer=KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer.players[kwId];if(playerState===YT_STATE_PLAYING){if(kwPlayer.lastPlayedTrackId!==undefined){$('#'+kwPlayer.lastPlayedTrackId).parent().parent().removeClass('playlist-playing');}playerRowElement.addClass('playlist-playing');kwPlayer.lastPlayedTrackId=trackId;}else{playerRowElement.removeClass('playlist-playing');}}}}});KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer.players[kwId]=new KwYoutubePlaylistPlayer(kwId,playlistId,iframe);KIRBY_WIKI_GLOBAL.youtubePlaylistPlayer.players[kwId].init();}}
);}addOnloadHook(initYoutubePlaylistPlayers);(function($){function modalUploadImageMessage(){var seeMore=$('.LatestPhotosModule').find('a.more');$(seeMore).wrap('<span />');$('<a href=\"http://kirby.wikia.com/wiki/Kirby Wiki:Editor\'s Manual\#Image_policies\" title=\"Kirby Wiki:Editor\'s Manual\#Image policies\" class=\"more\" style=\"margin-right: 5px\">(Image policy)</a>').insertAfter(seeMore);}addOnloadHook(modalUploadImageMessage);function removeTouchScreenScssOverride(){var element=$('link[rel="stylesheet"][href*="skins/oasis/css/touchScreen.scss"]');element.remove();}addOnloadHook(removeTouchScreenScssOverride);}(jQuery));;mw.loader.state({"site":"ready"});

/* cache key: enkirby:resourceloader:filter:minify-js:7:891ec915fb16822de7c84dda897c54c3 */