var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
  let window = _____WB$wombat$assign$function_____("window");
  let self = _____WB$wombat$assign$function_____("self");
  let document = _____WB$wombat$assign$function_____("document");
  let location = _____WB$wombat$assign$function_____("location");
  let top = _____WB$wombat$assign$function_____("top");
  let parent = _____WB$wombat$assign$function_____("parent");
  let frames = _____WB$wombat$assign$function_____("frames");
  let opener = _____WB$wombat$assign$function_____("opener");

if (active_page === "thread" || active_page === "index" ||  active_page === "ukko") {

$(document).on("ready", function() {
if (window.Options && Options.get_tab('general')) {
	Options.extend_tab("general", 
	"<fieldset><legend>Editor Dialog </legend>"
	+ ("<label class='sceditorc' id='sceditor'><input type='checkbox' /> Enable SCEditor WYSIWYG Editor</label>")
	+ "</fieldset>");
}

$('.sceditorc').on('change', function(){
	var setting = $(this).attr('id');

	localStorage[setting] = $(this).children('input').is(':checked');
	location.reload();
});

if (!localStorage.sceditor) {
	localStorage.sceditor = 'false';
}

function getSetting(key) {
	return (localStorage[key] == 'true');
}

if (getSetting('sceditor')) $('#sceditor>input').prop('checked', 'checked');

function initsceditor() { 
	if (!getSetting("sceditor")) {return;}
	$('.format-text').toggle();		
		
	$.sceditor.plugins.bbcode.bbcode.set('spoiler', {
		    tags: {
			            'span': {
					                'class': ['spoiler']
								        }
				        },
		    format: '[spoiler]{0}[/spoiler]',
			        html: '<span class="spoiler">{0}</span>'
	});
	$.sceditor.plugins.bbcode.bbcode.set('t', {
		    tags: {
			            'span': {
					                'class': ['heading']
								        }
				        },
		    format: '\t=={0}==\t',
			        html: '<span class="heading">{0}</span>'
	});
	$.sceditor.command.set("spoiler", {
	    exec: function() {
    	    this.insert("[spoiler]", "[/spoiler]");
			},
	    txtExec: ["[spoiler]", "[/spoiler]"],
	    tooltip: "Spoiler (CTRL+S)",
	});
	$.sceditor.command.set("t", {
	    exec: function() {
    	    this.insert("\t==", "==\t");
			},
	    txtExec: ["\t==", "==\t"],
	    tooltip: "Heading (CTRL+T)",
        });
	$('#body').sceditor({
	  plugins: 'bbcode',
	  style: $('#stylesheet').attr("href"), 
	  //style: '/stylesheets/sceditor/jquery.sceditor.default.min.css',
          toolbar: "bold,italic,t,spoiler,code|source",
	  emoticonsEnabled : false,
          autoUpdate : true,
	});
	var backgroundcolor = $('#body').css('background-color');
	$('.sceditor-container').css('background-color',backgroundcolor);
	$('.sceditor-toolbar').css('background-color',backgroundcolor);
	$('#body').sceditor('instance').css('body { background-color: ' + backgroundcolor +'; }');
	
	/*$(document).on('ajax_before_post', function (e, formData) {
		formData.set(body, $("#body").sceditor('instance').val());
	});

	$(document).on('ajax_after_post', function () {
		$("#body").sceditor('instance').val("");
	});*/
}
initsceditor();
});
}


}
/*
     FILE ARCHIVED ON 01:56:33 Jan 29, 2021 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 03:49:47 Mar 03, 2024.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
/*
playback timings (ms):
  exclusion.robots: 0.101
  exclusion.robots.policy: 0.088
  cdx.remote: 0.105
  esindex: 0.011
  LoadShardBlock: 263.265 (6)
  PetaboxLoader3.resolve: 251.798 (5)
  PetaboxLoader3.datanode: 199.801 (8)
  load_resource: 217.282 (2)
*/