AndyB
Well-known member
In my add-on Similar Threads, I use this .js file to show a list of similar threads when a user is creating a new thread. When the user starts typing into the title input the code should fire.
This code works fine in XenForo v1.2x, but it does nothing in XenForo v1.3 beta1.
similarthreads.js
Hopefully someone will be able to tell me which line of code needs to be changed.
Thank you.
This code works fine in XenForo v1.2x, but it does nothing in XenForo v1.3 beta1.
similarthreads.js
Code:
!function($, window, document, _undefined)
{
XenForo.similarthreadsId = function($form)
{
var typewatch = (function()
{
var timer = 0;
return function(callback, ms)
{
clearTimeout (timer);
timer = setTimeout(callback, ms);
}
})();
$title = $form.find('input[name="title"]');
$title.keyup(function()
{
typewatch(function ()
{
var pathname = $(location).attr('href');
var newPathname = pathname.replace('create-thread','similarthreads');
XenForo.ajax(
newPathname,
$form.serializeArray(),
function(ajaxData, textStatus)
{
if (ajaxData.templateHtml)
{
new XenForo.ExtLoader(ajaxData, function()
{
$('#similarthreadsId-result').html('<div>' + ajaxData.templateHtml + '</div>');
});
}
});
}, 500);
});
}
XenForo.register('#similarthreadsId', 'XenForo.similarthreadsId');
}
(jQuery, this, document);
Hopefully someone will be able to tell me which line of code needs to be changed.
Thank you.
Last edited: