XF 1.1 js/tinymce/themes/xenforo/js/code.js -> changed?

MagnusB

Well-known member
I upgraded to 1.1.3 shortly after it came out, however I just redownloaded the upgrade package, just to check the file above. In my fresh download the first lines read like this:
Code:
var CodeDialog = {
    init: function()
    {
    },

However, in mine the first few lines were these:
Code:
var CodeDialog = {
init: function()
{
alert(tinyMCEPopup.editor.windowManager.bookmark);
},

I also verified that the upgrade package contains the same file as the full package. Since the alert caused some problems for me when the insert code iframe was loaded, I reuploaded the code.js file, and now it fails the file health check. Any else noticed this? It is a small annoyance for me, as per this post, so I'd rather keep the "new" file.
 
The 1.1.3 default is:

Code:
var CodeDialog = {
	init: function()
	{
	},

	submit: function()
	{
		var ed = tinyMCEPopup.editor, tag, code, output;

		switch ($('#ctrl_type').val())
		{
			case 'html': tag = 'HTML'; break;
			case 'php':  tag = 'PHP'; break;
			default:     tag = 'CODE';
		}

		code = $('#ctrl_code').val();
		code = code.replace(/&/g, '&amp;').replace(/</g, '&lt;')
			.replace(/>/g, '&gt;').replace(/"/g, '&quot;')
			.replace(/\t/g, '    ').replace(/  /g, '&nbsp; ')
			.replace(/\n/g, '</p>\n<p>');

		output = '[' + tag + ']' + code + '[/' + tag + ']';
		if (output.match(/\n/))
		{
			output = '<p>' + output + '</p>';
		}

		tinyMCEPopup.restoreSelection();
		ed.execCommand('mceInsertContent', false, output);
		tinyMCEPopup.close();

		return false;
	}
};

tinyMCEPopup.onInit.add(CodeDialog.init, CodeDialog);

This version passes the checksum.
 
Not for me:
Code:
var CodeDialog = {
    init: function()
    {
    },
 
    submit: function()
    {
        var ed = tinyMCEPopup.editor, tag, code, output;
 
        switch ($('#ctrl_type').val())
        {
            case 'html': tag = 'HTML'; break;
            case 'php':  tag = 'PHP'; break;
            default:    tag = 'CODE';
        }
 
        code = $('#ctrl_code').val();
        code = code.replace(/&/g, '&amp;').replace(/</g, '&lt;')
            .replace(/>/g, '&gt;').replace(/"/g, '&quot;')
            .replace(/\t/g, '    ').replace(/  /g, '&nbsp; ')
            .replace(/\n/g, '</p>\n<p>');
 
        output = '[' + tag + ']' + code + '[/' + tag + ']';
        if (output.match(/\n/))
        {
            output = '<p>' + output + '</p>';
        }
 
        tinyMCEPopup.restoreSelection();
        ed.execCommand('mceInsertContent', false, output);
        tinyMCEPopup.close();
 
        return false;
    }
};
 
tinyMCEPopup.onInit.add(CodeDialog.init, CodeDialog);

That file is uploaded from zip I downloaded a few days ago here. Filehealth results:
filehealth.webp

As I said, it is more an annoyance, but still something I would like to fix.
 
I did not open the file it self, I just navigated to the URL and copy pasted the content. If you see here, I am not the only one having the issue, though I am not sure if anyone else tried re uploading the js file.
 
Top Bottom