Howto change the xibo client the correct way

Asked by Tim

Hi,

I wan't to add a new functionality to Xibo so that it is possible to show a scrolling text only once and not time based.

Therefor i have made the text module in the xibo management screen less strict, the value 0 for duraction is allowed.

Only now i need to change the way the text is showed on screen in xibo client, specific in the JS part.
After research i know that the JS can be found in \modules\preview\HtmlTemplateForGetResource.html.
But this is all minified code, where can i find the original code?

Gr, Tim

Question information

Language:
English Edit question
Status:
Answered
For:
Xibo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Harrington (alexharrington) said :
#1

The jQuery code in the file is minified and is their release code
unmodified.

The Xibo specific code in the file isn't minified.

Revision history for this message
Tim (info-u-deactivatedaccount) said :
#2

On rule 68 of that file i see the code below:

jQuery.fn.extend({xiboRender:function(e,t){var n={type:"ticker",direction:"single",duration:"50",durationIsPerItem:false,numItems:0,takeItemsFrom:"start",itemsPerPage:0,scrollSpeed:"2",scaleMode:"scale"};var e=$.extend({},n,e);e.width=$(window).width();e.height=$(window).height();e.scaleFactor=Math.min(e.width/e.originalWidth,e.height/e.originalHeight);this.each(function(){if(e.type=="ticker"){if(e.sourceid==undefined){console.error("Source ID undefined - assuming 1");e.sourceid=1}if(e.sourceid==1){if(e.takeItemsFrom=="end"){t.reverse()}if(e.numItems>t.length||e.numItems==0)e.numItems=t.length;e.items=t.slice(0,e.numItems);if(e.takeItemsFrom=="end"){t.reverse()}}else{e.numItems=t.length}}var n=e.numItems;var r=e.itemsPerPage>0?Math.ceil(e.numItems/e.itemsPerPage):e.numItems;var i=1;var s=this;for(var o=0;o<t.length;o++){if(e.direction=="single"&&e.itemsPerPage>0&&(i>=e.itemsPerPage||o==0)){s=$("<div/>").addClass("page").appendTo(this);i=0}$("<div/>").addClass("item").html(t[o]).appendTo(s);i++}if(e.scaleMode=="fit"){$("*",this).css("font-size","");$(this).css({width:e.originalWidth,height:e.originalHeight}).fitText(1.75)}else if(e.scaleMode=="scale"){$(this).css({zoom:e.scaleFactor,width:e.originalWidth,height:e.originalHeight})}var u=false;if(e.direction=="single"){var a=e.itemsPerPage>0?"> .page":"> .item";var f=e.itemsPerPage>0?r:n;var l=e.durationIsPerItem?e.duration:e.duration/f;$(this).cycle({fx:e.transition,timeout:l*1e3,slides:a})}else if(e.direction=="left"||e.direction=="right"){u=true;$(" .item",this).css({display:"inline","padding-left":"4px"});$(" .item p",this).css({display:"inline"})}else if(e.direction=="up"||e.direction=="down"){u=true}if(u){var c=$("<div/>").addClass("scroll").attr({scrollamount:e.scrollSpeed,scaleFactor:e.scaleFactor,behaviour:"scroll",direction:e.direction,height:e.originalHeight,width:e.originalWidth});$(this).wrapInner(c);$(this).find(".scroll").marquee()}})},dataSetRender:function(e){if(e===undefined||e===null){e={duration:5,transition:"fade"}}$(this).each(function(){var t=$(this).attr("totalPages");$(this).cycle({fx:e.transition,timeout:e.duration*1e3/t,slides:"> table"})})}});if(!window.console){(function(){var e=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"],t,n=e.length;window.console={};for(t=0;t<n;t++){window.console[e[t]]=function(){}}})()}

Revision history for this message
Alex Harrington (alexharrington) said :
#3

That is the original code. There's no minification involved as far as I'm
aware.

Minification would involve using 1 character variable names etc.

Revision history for this message
Tim (info-u-deactivatedaccount) said :
#4

There is also a JS file (xibo-text-render.js) in the same dir with the code a showed below (just a snippet):

jQuery.fn.extend({
    xiboRender: function(options, items) {

        //console.log("[Xibo] Render");

        // Default options
        var defaults = {
            "type": "ticker",
            "direction": "single",
            "duration": "50",
            "durationIsPerItem": false,
            "numItems": 0,
            "takeItemsFrom": "start",
            "itemsPerPage": 0,
            "scrollSpeed": "2",
            "scaleMode": "scale"
        };

        var options = $.extend({}, defaults, options);

If you compare this snippet with the code in my previous post you will see that options and items are changed to e and t.

You say also that minification would involve using 1 character in my previous post var names with one character are used.

The code that i show is from xiboRender function that is a part of Xibo not from jQuery.

It is not handy to change that piece of code.

Revision history for this message
Alex Harrington (alexharrington) said :
#5

Hi Tim

It may not be handy to edit, but as far as I'm aware that is the source as
it stands.

Alex

Revision history for this message
tonytong (tonytong198) said :
#6

i find a free online service to minify js http://www.online-code.net/minify-js.html and compress css http://www.online-code.net/minify-css.html, so it will reduce the size of web page.

Can you help with this problem?

Provide an answer of your own, or ask Tim for more information if necessary.

To post a message you must log in.