修改 jQuery 插件以使用特定的 jQuery 实例?

Modify a jQuery plugin to use a specific jQuery instance?

我在让 tablesorter jQuery 插件使用 jQuery 的 noConflict 实例时遇到问题,这是必需的,因为强制模板会加载 jquery 的不同实例在页面的最底部。根据我的阅读,我需要下载 tablesorter js 插件的本地副本并对其进行修改,以便它将使用 jQuery 的特定 noConflict 实例。我已经尝试了几次,但无法弄清楚需要对 tablesorter 插件进行哪些修改才能完成这项工作。非常感谢任何有关如何执行此操作的建议或文档。

工作代码:

<script src="static/jquery.min.js" type="text/javascript"></script>
<script src="static/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {      
    $("#testTable").tablesorter({
        sortInitialOrder: "desc",
    });
}); 
</script>

非工作代码:

<script src="static/jquery-1.12.2.min.js"></script>
<script type="text/javascript">
jQuery_1_12_2 = $.noConflict(true);
</script>
<script src="static/jquery.tablesorter.min.modified.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery_1_12_2(document).ready(function() {      
    jQuery_1_12_2("#testTable").tablesorter({
        sortInitialOrder: "desc",
    });
});
</script>

我已经尝试更改 tablesorter 插件的第一行和最后一行以及两者的组合但没有成功:

Tablesorter 修改

(function(jQuery_1_12_2){$.extend({tablesorter:new
...
(jQuery_1_12_2);

脚本的顺序在这种情况下非常重要。在将插件添加到 jQuery 之前,不要使用 noConflict() 函数。试试这个:

<script src="static/jquery-1.12.2.min.js"></script>
<script src="static/jquery.tablesorter.min.modified.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery_1_12_2 = $.noConflict(true);

jQuery_1_12_2(document).ready(function() {      
    jQuery_1_12_2("#testTable").tablesorter({
        sortInitialOrder: "desc"
    });
});
</script>