MediaWiki:Wikia.js

/* */ /*	Loads the current source of the page "pagename" (as stored in the database) and inserts it at the cursor position function doPreload(pagename) {	var loader = new ContentLoader; loader.callback = onPreloadArrival; loader.send('/index.php?title=' + pagename + '&action=raw&ctype=text/plain'); } function insertAtCursor(myField, myValue) {	//IE support if (document.selection) {		myField.focus; sel = document.selection.createRange; sel.text = myValue; }	//MOZILLA/NETSCAPE support else if(myField.selectionStart || myField.selectionStart == '0') {		var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length); }	else {		myField.value += myValue; } } function onPreloadArrival {	if($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source').length){ insertAtCursor($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source')[0], this.text); tutloader('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source'); }else{ insertAtCursor(document.getElementById('wpTextbox1'), this.text); tutloader('#wpTextbox1'); } } /*	end preload code /* Template Preloads * Original by User:Grunny * Source - w:c:starwars:MediaWiki:Wikia.js * Altered to replace Wiki's template preloads by runescape wiki */ function customPreloadTemplates { if ( ( mw.config.get( 'wgAction' ) !== 'edit' && mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'CreatePage' ) || !$( 'div.module_content' ).length ) { return; }	var	preloadOptionsHtml = '', $preloadOptionsList, preloadBaseHtml = ' Standard preloads: ' +			' Custom preload pagename: '	$( 'span.cke_buttons.cke_toolbar_templates' ).replaceWith( preloadBaseHtml ); $.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdpreloads', action: 'raw', ctype: 'text/plain' }, function( data ) {		var lines = data.split( '\n' );		for( var i = 0; i < lines.length; i++ ) {			var value = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : "";			preloadOptionsHtml += '' + lines[i] + ' ';		}		$preloadOptionsList = $( ' ' ).attr( 'id', 'stdSummaries' ).html( preloadOptionsHtml ).change( function { var value = $( this ).val; if ( value !== '' ) { value = 'Template:' + value + '/preload'; value = value.replace( ' ', '_' ); $.get( mw.config.get( 'wgScript' ), { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) {

if($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source').length){ insertAtCursor($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source')[0], data); tutloader('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source'); }else{ insertAtCursor(document.getElementById('wpTextbox1'), data); tutloader('#wpTextbox1'); }				} );			}		} );		$( 'div#lf-preload' ).append( $preloadOptionsList ); } );	$( '#lf-preload-pagename-w' ).html( '' );	$( '#lf-preload-button-w' ).html( '' ); } $( customPreloadTemplates ); $(function { if (window.CKEDITOR) { CKEDITOR.on("instanceReady", function {					$( customPreloadTemplates );			}); } });

function doCustomPreloadOasis { var value = $( '#lf-preload-pagename-w > input' ).val; value = value.replace( ' ', '_' ); $.get( mw.config.get( 'wgScript' ), { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) {

if($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source').length){ insertAtCursor($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source')[0], data); tutloader('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source'); }else{ insertAtCursor(document.getElementById('wpTextbox1'), data); tutloader('#wpTextbox1'); }	} ); }

//link to converter; thanks to UltimateSupreme with helping to put it for visual editors as well w:c:Thread:608344 $(function converter { converticon="  Convert "; $('.cke_button.RTEImageButton.cke_button_big').append(converticon);	   if (window.CKEDITOR) {			CKEDITOR.on("instanceReady", function  { $(converter); });	  } });

$(function formatbutton { formaticon="  Format  "; $('.cke_button.RTEImageButton.cke_button_big').append(formaticon);	   if (window.CKEDITOR) {			CKEDITOR.on("instanceReady", function  { $(formatbutton); console.log('Instance ready'); formatcaller; });	  }else{ console.log('I was born ready');					formatcaller;} });

/*Custom YT player*/ $(function ytloader {	if (document.querySelector('.ytsample') !== null) {		$('.ytsample').ready(function{ var ytid=document.querySelector('.ytsample').title; var yttemplate1=" "; $('.ytsample').append(yttemplate1+ytid+yttemplate2); });	} });

/*Custom TMbox player*/ $(function tmloader {	if (document.querySelector('.tmsample') !== null) {		$('.tmsample').ready(function{ var tmid=document.querySelector('.tmsample').title; var tmtemplate1=" "; $('.tmsample').append(tmtemplate1+tmid+tmtemplate2); });	} });

var anch = function{$('.anchor').click(function{	$('.tutc').scrollTop($('.tutc').scrollTop-$('.tutnav').height+$('#'+this.getAttribute("name")).position.top);	if(this.getAttribute("name")=='about'){		if($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source').length){			tutloader('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source');		}else{			tutloader('#wpTextbox1');		}	} })};

var text = ;

var tutloader = function(t){ var templates = ['{{infobox character', '{{playlist', '{{album', '{{album|type=collab', '{{song', '{{song chorus', '{{ytvideo', '{{utattemita tours', '{{anikora', '{{singer spotlight', '{{gallery']; var nav = [' ref resh cite refs ', ' sin ger ', ' song list ', ' CD ', ' Coll CD ', ' So ng ', ' Cho rus ', ' YT CB ', ' UT tour ', ' ani kora ', ' spot light ', ' gall ery tri via ', ' cite illus rep rint li nk '] var load = text[0]; var loadnav = nav[0]; for (var i=0; i-1) { //general, singer, playlist, album, collabalbum, song, songchorus, battle, tour, anikora, spotlight, gallery-trivia, illust-reprint-link load += text[i+1]; loadnav += nav[i+1]; }	}	load += text[12]; loadnav += nav[12]+" "; $('.tutnav').html(loadnav); $('.tutc').html(load); anch; };

$('#EditPage').ready(function{	if (window.location.href.indexOf("action=edit") > -1) {		var intervalID = setInterval(function{ if ($('#cke_21').length) { clearInterval(intervalID); $('.cke_button_ModeWysiwyg').css({'display':'none'}); $('#cke_21').trigger('click'); $('#EditPageMainContainer').css({'width':'calc(100% - ('+$('.tuttrigger').css('left')+' + '+$('.editpage-widemode-trigger').css('right')+'))'}); $('#cke_contents_wpTextbox1').css({'height':'calc('+$('#WikiaPage').height+' - ('+$('#EditPageEditNotice').height+' + '+$('#EditPageToolbar').height+'))'}); }		}, 3000);		var closed=true;		$('#EditPage').append("  ");		$('#EditPageMain').prepend("    ");		$('#EditPageMainContainer').css({'width':'calc(100% - ('+$('.tuttrigger').css('left')+' + '+$('.editpage-widemode-trigger').css('right')+'))'});		$('#cke_contents_wpTextbox1').css({'height':'calc('+$('#WikiaPage').height+' - ('+$('#EditPageEditNotice').height+' + '+$('#EditPageToolbar').height+'))'});		$('.tutrail').css({'height':$('#EditPageMainContainer').height});		$('#EditPageMainContainer').css({'float':'left'});		$('.tuttrigger').click(function{ if(closed){ $('.tuttrigger').css({'left':'300px'}); $('.tutrail').css({'display':'block'}); closed=false } else { $('.tuttrigger').css({'left':'0'}); $('.tutrail').css({'display':'none'}); closed=true; }			$('#EditPageMainContainer').css({'width':'calc(100% - ('+$('.tuttrigger').css('left')+' + '+$('.editpage-widemode-trigger').css('right')+'))'}); $('.tutrail').css({'height':$('#EditPageMainContainer').height});

if($('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source').length){ tutloader('#cke_wpTextbox1 #cke_contents_wpTextbox1 .cke_source'); }else{ tutloader('#wpTextbox1'); }		});	};	$('.editpage-widemode-trigger').click(function{ $('#EditPageMainContainer').css({'width':'calc(100% - ('+$('.tuttrigger').css('left')+' + '+$('.editpage-widemode-trigger').css('right')+'))'}); $('.editpage-widemode-trigger').css({'top':'42px'}); });	$(window).resize(function { $('#EditPageMainContainer').css({'width':'calc(100% - ('+$('.tuttrigger').css('left')+' + '+$('.editpage-widemode-trigger').css('right')+'))'}); $('.tutrail').css({'height':$('#EditPageMainContainer').height}); }); });

$('#NewarticletextNS').ready(function{	if (window.location.href.indexOf("useFormat=1") > -1) {		var loc = [{locations:['.editpage-widemode-trigger', '.module.module_templates h3'],			message:'First, expand the right siderail and scroll to \"Templates\" OR click on one of the Layout options above. Click here for next step.'},			{locations:['#lf-preload #stdSummaries'],			message:'Use the \"Templates\" section for adding page layouts and additional templates if needed. Click here for next step.'},			{locations:['.module.module_insert h3', '.cke_button.RTEImageButton.cke_button_big a:first-child', '.cke_button.RTEImageButton.cke_button_big a:nth-child(2)'],			message:'In the \"Add features and media\" sections, use \"Convert\" for converting images to .png, and \"Upload\" for uploading images. Click here for next step.'},			{locations:['.tuttrigger', '.tutnav'],			message:'Expand the right siderail to see the tutorial, and use the bubbles on top for navigation. If you\'re ready to start, click here.'}];

var step=0; $('#NewarticletextNS p').append(' '); $('.tutorialtooltip').css({'width':'calc(100% - 20px)'}).css({'max-width':'none'}).css({'margin':'0'}); $('.tutorialtooltip').html(loc[step].message); for (var i=0; i<loc[step].locations.length; i++){ $(loc[step].locations[i]).addClass('activestep'); }		$('.tutorialtooltip').click(function{			for (var i=0; i<loc[step].locations.length; i++){				$(loc[step].locations[i]).removeClass('activestep');			}			step++;			if(step==4){				$('.tutorialtooltip').remove			} else {				for (var i=0; i<loc[step].locations.length; i++){					$(loc[step].locations[i]).addClass('activestep');				}				$('.tutorialtooltip').show;				$('.tutorialtooltip').html(loc[step].message);			}		}); } });

/* Other imports */ importArticles({	type: "script",	articles: [		"w:dev:AjaxRC/code.js",		"w:dev:Standard_Edit_Summary/code.js",	] });

switch (mw.config.get('wgPageName')) { case 'Utaite_Wiki:Tutorial': $(document).ready(function {	var step = 0;	var info = [{		triggerlocation:'.WikiaMenuElement li a.createpage',		locations:['.wikia-menu-button.contribute.secondary.combined'],		message:"Welcome to the Utaite Wiki editing tutorial! Learn editing and the syntax on our wiki at your own pace in an interactive way! This tutorial focuses on source code editing. If you\'re ready, go ahead and click the \"Contribute\" button above! For bug reports, please contact BLUEBIRD"	},	{		triggerlocation:'button.button.normal.primary',		locations:['#CreatePageDialogFormatContainer', '#wpCreatePageDialogTitle'],		message:"Input your preferred pagename, and select \"With Tutorial\" for tutorial hints. Once you\'re comfortable editing without hints, check the \"Without tutorial\" option. Once selected, click the \"Add a Page\" button."	}]; (function {		$(info[step].triggerlocation).addClass("activestep");		for (var i=0; i< info[step].locations.length; i++) {			$(info[step].locations[i]).addClass("activestep");		};		$(info[step].triggerlocation).addClass("activestep");		$(info[step].locations[0]).append( ' '+info[step].message+' ' )	});	$(info[step].triggerlocation).click(		function {			var intervalID = setInterval(function{ if ($('#CreatePageDialogFormatContainer').length) { clearInterval(intervalID); $('ul#CreatePageDialogChoices #CreatePageDialogFormatContainer label').html("With tutorial"); $('ul#CreatePageDialogChoices #CreatePageDialogBlankContainer label').html("Without tutorial<img src='http://slot1.images.wikia.nocookie.net/__cb1480701179/common/extensions/wikia/CreatePage/images/thumbnail_blank.png'>"); $('.tutorialtooltip').remove; for (var i=0; i< info[step].locations.length; i++) { $(info[step].locations[i]).removeClass("activestep"); };					$(info[step].triggerlocation).removeClass("activestep"); step++; $(info[step].triggerlocation).addClass("activestep"); for (var i=0; i< info[step].locations.length; i++) { $(info[step].locations[i]).addClass("activestep"); };					$(info[step].locations[0]).css({'width':'calc(50% - 5px)'}); $(info[step].locations[0]).append(						' '+info[step].message+' '					); $('.tutorialtooltip').css({'margin' : 0}).css({'position' : 'relative'}).css({'max-width' : 'none'}).css({'width' : 'auto'}); }			}, 3000);		}	); $('#WikiaArticle #mw-content-text .t').show; var tmp=""; for (var i=0; i<text.length; i++){ tmp += text[i]; }	$('#WikiaArticle #mw-content-text .t').html(tmp); })		break; }

var formatcaller=function{ $('#formatter').click(function{	if ($('#formatter').hasClass('formatteropen')) {		$('#formatter').removeClass('formatteropen');		$('#formatcontent').empty;		return;	}	$('#formatter').addClass('formatteropen');	$('#formatcontent').append(" <img src='http://slot1.images.wikia.nocookie.net/__cb1481713639/common/skins/oasis/images/icon_close.png'> NND mylists  <input type='text' name='nnd' placeholder='7359936 25396393 31424334 13892546 26633779'>  YT usernames  <input type='text' name='ytun' placeholder='splendiferousfantasy'>  YT channels  <input type='text' name='ytch' placeholder='UCMsNS10PzxzEayT7UHS4p6g'>  YT playlists  <input type='text' name='ytpl' placeholder='PLOA7lc-qUd88NjN4adz8Di8ZHT6jwIFrS PLOA7lc-qUd8_mcFeaVAKWKbg9FSy35SIV'>  TmBox ID  <input type='text' name='tm' placeholder='soraruru uni_mafumafu'>  SoundCloud ID  <input type='text' name='sc' placeholder='sumashu missingnumber'>  <input type='button' value='Format!'> "); format; }); function song(title, yt, nnd, tm, sc, date) {			this.title = title;			this.yt = yt;			this.nnd = nnd;			this.tm = tm;			this.sc = sc;			this.date = date;		};

var format = function{ $('#formatwindow input[type=button]').click(function{		var nnd=[];		var ytun=[];		var ytch=[];		var ytpl=[];		var tm=[];		var sc=[];		var list=[];		var listtm=[];		var listsc=[];		var yt1 = "https://www.googleapis.com/youtube/v3/search?order=date&part=snippet";		var yt2 = "&maxResults=50&key=";		var ytkey = "AIzaSyCzK_pJY61etE2i8JcWhguSVD7Hzl6tusA";		if(!$('input[name=nnd]').val==''){			nnd=$('input[name=nnd]').val.split(" ");			for (var i=0; i<nnd.length; i++){				var url = "https://query.yahooapis.com/v1/public/yql?q=select%20title%2CpubDate%2Clink%20from%20rss%20where%20url%3D'http%3A%2F%2Fwww.nicovideo.jp%2Fmylist%2F"+nnd[i]+"%2Fvideo%3Frss%3D2.0'&diagnostics=true";				$.ajax({ type: "GET" , url: url, dataType: "xml" , success: function(xml) { $(xml).find('item').each(function{							list.push(new song($(this).find('title').text, , $(this).find('link').text.split("/watch/")[1], , '', $(this).find('pubDate').text.split(' ')[3]+'.'+getmon($(this).find('pubDate').text.split(' ')[2])+'.'+$(this).find('pubDate').text.split(' ')[1]))						}); }				});			}		};		if(!$('input[name=ytch]').val==){			ytch=$('input[name=ytch]').val.split(" ");			var token="";			for (var i=0; i<ytch.length; i++){				ytchformat(ytch[i], , list);			}		};		if(!$('input[name=ytun]').val==){			ytun=$('input[name=ytun]').val.split(" ");			var token="";			for (var i=0; i<ytun.length; i++){				ytunformat(ytun[i], , list);			}		};		if(!$('input[name=ytpl]').val==){			ytpl=$('input[name=ytpl]').val.split(" ");			var token="";			for (var i=0; i<ytpl.length; i++){				ytplformat(ytpl[i], , list);			}		};		if(!$('input[name=tm]').val==){			tm=$('input[name=tm]').val.split(" ");			var u1="https://tmbox.net/user/"			var u2="?page=";			for (var i=0; i<tm.length; i++){				console.log('A');				tmformat(u1+tm[i]+u2, 1, listtm);			}		};		if(!$('input[name=sc]').val==){			sc=$('input[name=sc]').val.split(" ");			var url ="";			for (var i=0; i<sc.length; i++){ url ="http://api.soundcloud.com/resolve.json?url=http://soundcloud.com/"+sc[i]+"/tracks&client_id=887b335a80f3e625454ebca548c53d96"; $.ajax({					type: "GET" ,					url: url,					dataType: "json" ,					success: function(json) {						for (var j=0; j<json.length; j++){							listsc.push(new song(json[j].title, , , '', json[j].permalink, json[j].created_at.split(' ')[0].replace('/', '.').replace('/', '.')));						}					}				}); }		};		//$(document).ajaxStop(function{}) $(document).ajaxStop(function{			list.sort(function(a, b){ if(a.title < b.title) return -1; if(a.title > b.title) return 1; return 0; });			list.sort(function(a, b){ if(a.date < b.date) return -1; if(a.date > b.date) return 1; return 0; });			for (var i=0; i<list.length - 1; i++) {				if ((list[i+1].title==list[i].title)&&(list[i + 1].date == list[i].date)) {					if(list[i+1].nnd!=){						list[i].nnd=list[i+1].nnd;					}else{						list[i].yt=list[i+1].yt;					}					list.splice(i+1, 1);					i--;				}			}			var out='==List of Covered Songs==\n{{Playlist|content = \n';			var ver=;			for (var i=0; i<list.length; i++){				ver=verformat(list[i].title);				//console.log(list[i].title+" "+list[i].date+" "+list[i].yt+" "+list[i].nnd);				if (list[i].yt==){					out=out.concat("#\""+list[i].title+"\" {{nnd|"+list[i].nnd+"}}"+ver+" ("+list[i].date+")\n")				} else if (list[i].nnd==) {					out=out.concat("#\"["+list[i].yt+" "+list[i].title+"]\""+ver+" ("+list[i].date+")\n")				} else {					out=out.concat("#\"["+list[i].yt+" "+list[i].title+"]\" {{nnd|"+list[i].nnd+"}}"+ver+" ("+list[i].date+")\n")				}			}			out=out.concat('}}\n'); var outtm='===Songs on TmBox===\n{{Playlist|notice = tmbox|content = \n' for (var i=0; i<listtm.length; i++){ ver=verformat(list[i].title); outtm=outtm.concat("#\"["+list[i].tm+" "+list[i].title+"]\""+ver+" ("+list[i].date+")\n"); //console.log(listtm[i].title+" "+listtm[i].date+" "+listtm[i].tm); }			outtm=outtm.concat('}}\n'); if (listtm.length<=0){ outtm=''; }			var outsc='===Songs on SoundCloud===\n{{Playlist|notice = soundcloud|content = \n' for (var i=0; i<listsc.length; i++){ ver=verformat(list[i].title); outsc=outsc.concat("#\"["+list[i].sc+" "+list[i].title+"]\""+ver+" ("+list[i].date+")\n"); //console.log(listsc[i].title+" "+listsc[i].date+" "+listsc[i].sc); }			outsc=outsc.concat('}}\n'); if (listsc.length<=0){ outsc=''; }			console.log(out); console.log(outsc); console.log(outtm); $('#formatcontent').html(" <img src='http://slot1.images.wikia.nocookie.net/__cb1481713639/common/skins/oasis/images/icon_close.png'> "+out+outsc+outtm+" "); $('#formatwindow .close').click(function{				$('#formatcontent').empty;			}); })	}) } var verformat = function(title){ var tmp='-'; if (title.toLowerCase.indexOf('english')>-1||title.indexOf('英語')>-1){ tmp+='English '; }	if (title.toLowerCase.indexOf('french')>-1||title.indexOf('Français')>-1){ tmp+='French '; }	if (title.toLowerCase.indexOf('german')>-1||title.indexOf('Deutsch')>-1){ tmp+='German '; }	if (title.toLowerCase.indexOf('chinese')>-1||title.indexOf('中文')>-1){ tmp+='Chinese '; }	if (title.toLowerCase.indexOf('spanish')>-1||title.indexOf('Español')>-1){ tmp+='Spanish '; }	if (title.toLowerCase.indexOf('indonesia')>-1){ tmp+='Indonesian '; }	if (title.toLowerCase.indexOf('rap')>-1){ tmp+='Rap '; }	if (title.toLowerCase.indexOf('screamo')>-1){ tmp+='Screamo '; }	if (title.toLowerCase.indexOf('piano')>-1||title.indexOf('ピアノ')>-1){ tmp+='Piano '; }	if (title.toLowerCase.indexOf('tv size')>-1){ tmp+='TV size '; }	if (title.toLowerCase.indexOf('band')>-1||title.indexOf('バンド')>-1){ tmp+='Band '; }	if (title.toLowerCase.indexOf('acoustic')>-1){ tmp+='Acoustic '; }	if (title.toLowerCase.indexOf('arrange')>-1||title.indexOf('アレンジ')>-1){ tmp+='Arrange '; }	if (tmp=='-') { return ''; }	return tmp+'ver.-' } var ytunformat = function(url, token, list){ var u = "https://www.googleapis.com/youtube/v3/channels?key=AIzaSyD5bC5qiEP-_25Llg2ciYNM9sW-WP6a6ck&part=id&forUsername="+url; $.ajax({		type: "GET" ,		url: u,		dataType: "json" ,		success: function(json) {			u="https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&maxResults=50&key=AIzaSyD5bC5qiEP-_25Llg2ciYNM9sW-WP6a6ck&channelId="+json.items[0].id;			var turl;			if (token==''){				turl=u;			}else{				turl=u+"&pageToken="+token;			}			$.ajax({ type: "GET" , url: turl, dataType: "json" , success: function(json) { token=json.nextPageToken; for (var j=0; j<json.items.length; j++){ if (json.items[j].id.videoId!=null){ list.push(new song(json.items[j].snippet.title, json.items[j].id.videoId, , , '', json.items[j].snippet.publishedAt.split('T')[0].replace('-', '.').replace('-', '.'))); }					}					if (token!=null){ ytunformat(url, token, list); }				}			});		}	}); }; var ytchformat = function(url, token, list){ var u = "https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&maxResults=50&key=AIzaSyD5bC5qiEP-_25Llg2ciYNM9sW-WP6a6ck&channelId="+url; var turl; if (token==''){ turl=u; }else{ turl=u+"&pageToken="+token; }	$.ajax({		type: "GET" ,		url: turl,		dataType: "json" ,		success: function(json) {			token=json.nextPageToken;			for (var j=0; j<json.items.length; j++){				if (json.items[j].id.videoId!=null){					list.push(new song(json.items[j].snippet.title, json.items[j].id.videoId, , , '', json.items[j].snippet.publishedAt.split('T')[0].replace('-', '.').replace('-', '.')));				}			}			if (token!=null){				ytchformat(url, token, list);			}		}	}); }; var ytplformat = function(url, token, list){ var u = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&key=AIzaSyD5bC5qiEP-_25Llg2ciYNM9sW-WP6a6ck&playlistId="+url; var turl; if (token==''){ turl=u; }else{ turl=u+"&pageToken="+token; }	$.ajax({		type: "GET" ,		url: turl,		dataType: "json" ,		success: function(json) {			token=json.nextPageToken;			for (var j=0; j<json.items.length; j++){				if (json.items[j].snippet.resourceId.videoId!=null){					list.push(new song(json.items[j].snippet.title, json.items[j].snippet.resourceId.videoId, , , '', json.items[j].snippet.publishedAt.split('T')[0].replace('-', '.').replace('-', '.')));				}			}			if (token!=null){				ytplformat(url, token, list);			}		}	}); }; var tmformat = function(url, page, listtm){ console.log('B'); $.ajaxPrefilter( function (options) {		if (options.crossDomain && jQuery.support.cors) {			var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');			options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;		}	}); var t=false; console.log('C'); console.log(url+page); $.ajax({		url: url+page,		success: function(html) {		console.log('D');			t=(html.indexOf(" ")>-1);			html=html.split(" ")[0].replace(/(?:\r\n|\r|\n)/g, '');			var items =html.split(" ");			for (var q=1; q<items.length; q++){				$.ajax({ indexValue:{title: items[q].split(" ")[1].split("</a>")[0], link: items[q].split(" ")[0]}, url:'https://tmbox.net'+items[q].split(" ")[0], success: function(h){ h=h.split("<i class='icon clock fitted'></i>")[1].split(" ")[0].trim.replace("/", ".").replace("/", "."); tmp.date=h; listtm.push(new song(this.indexValue.title, , , this.indexValue.link, '', h)); }				})			}			if (t){				page++;				tmformat(url, page, listtm);			}		}	}); }; var getmon = function(mon){ switch(mon) { case 'Jan': return '01'; break; case 'Feb': return '02'; break; case 'Mar': return '03'; break; case 'Apr': return '04'; break; case 'May': return '05'; break; case 'Jun': return '06'; break; case 'Jul': return '07'; break; case 'Aug': return '08'; break; case 'Sep': return '09'; break; case 'Oct': return '10'; break; case 'Nov': return '11'; break; case 'Dec': return '12'; break; } }

} /* */