The following warnings occurred:
Warning [2] Undefined array key "sourceeditor" - Line: 718 - File: inc/plugins/rineditor.php PHP 8.2.22 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/rineditor.php 718 errorHandler->error_callback
/inc/plugins/rineditor.php 776 rineditor_inserter_quick
/inc/class_plugins.php 142 rineditor
/showthread.php 471 pluginSystem->run_hooks



effone   13-06-2020, 01:36 AM
#1
For those lazy heads: let's save a click!

To generate a new syndication URL you need to click on the "Generate Syndication URL" button after choosing your desired forums, syndication version and limit. This will generate the URL on the fly in front of your eyes as you change your preference. Lets do it.

Open the template misc_syndication and find the variable {$feedurl}. Add the following script before that:
Note: You need to add the script before the var, not after, else jQuery will be confused to identify the element holding URL.
<script>$(function(){var i=parseInt($("input[name=limit]").val(),10),t=[];$("input[type=submit]").hide(),$(":contains(syndication.php):last").attr("id","feedurl"),$("select[name='forums[]'], input[name='version'], input[name=limit]").on("change keyup",function(){t.fid=$("select[name='forums[]']").val(),t.fid=0===t.fid.length||0===$.inArray("all",t.fid)?"":"fid="+t.fid.join(","),t.ver=$("input[name='version']:checked").val(),t.ver=""===t.ver||"rss2.0"===t.ver?"":"type="+t.ver,t.lmt=$("input[name=limit]").val(),t.lmt="limit="+(isNaN(t.lmt)||t.lmt<1?i:t.lmt),t=[t.fid,t.ver,t.lmt].filter(function(i){return""!==i}),$("#feedurl").text(rootpath+"/syndication.php?"+t.join("&"))})});</script>

Thats all.

This will hide the "Generate Syndication URL" button, but don't worry, wee don't need that anymore.

Now save the template. Done.

Result:
[Image: screen.gif]

tl;dr:
For the readability of the curious minds, this is the expanded version of the script (which you can also use in place of the above):
<script type="text/javascript">
$(function(){
    var rootLimit = parseInt($("input[name=limit]").val(), 10), param = [];
    $("input[type=submit]").hide();
    $(":contains(syndication.php):last").attr('id', 'feedurl');
    $("select[name='forums[]'], input[name='version'], input[name='limit']").on('change keyup', function(){
        param.fid = $("select[name='forums[]']").val();
        param.fid = (param.fid.length === 0 || $.inArray("all", param.fid) === 0) ? "" : "fid="+param.fid.join(",");
        param.ver = $("input[name='version']:checked").val();
        param.ver = (param.ver === "" || param.ver === "rss2.0") ? "" : "type="+param.ver;
        param.lmt = $("input[name=limit]").val();
        param.lmt = "limit=" + ((isNaN(param.lmt) || param.lmt < 1) ? rootLimit : param.lmt);
        param = [param.fid,param.ver,param.lmt].filter(function(v){return v!==''});
        $("#feedurl").text(rootpath + "/syndication.php?" + param.join("&"));
    });
});
</script>
This post was last modified: 13-06-2020, 04:47 AM by effone. Edit Reason: Resize embedded image
  
Users browsing this thread: 1 Guest(s)
Powered By MyBB, © 2002-2024 MyBB Group.
Made with by MattyWjeisz of Curves UI.