1var xaraSwidgets_coinSliderNonav_v8Templates = { 2 3 entry: '<a href="{link}">' 4 + '<img src="{image}">' 5 + '<span>{desc}</span>' 6 + '</a>', 7 8 main: '<div id="{component_id}OuterDiv" class="coin-slider_nonav">' 9 + '{entryhtml}' 10 + '</div>' 11 12 13 14}; 15 16function xsw_csnn_htmlbr(str) { 17 if (str == undefined) 18 return ''; 19 var lines = str.split("\n"); 20 for (var t = 0; t < lines.length; t++) { 21 lines[t] = $("<p>").text(lines[t]).html(); 22 } 23 return lines.join("<br/>"); 24} 25 26// this is the constructor for a component 27// it loops through each 'entry' in the array of data and compiles the entry template for it 28// it then applies the resulting HTML to the main template before writing the whole lot to the div on the page 29// it then initialises the actual jquery plugin for the div (that now contains the required HTML as a result of writing the template to it) 30function xaraSwidgets_coinSliderNonav_v8Constructor(divID, data) 31{ 32 var entryHTML = ''; 33 34 // loop through each entry in the array and compile the entry template for it 35 for(var i=0; i<data.length; i++) 36 { 37 data[i].desc = xsw_csnn_htmlbr(data[i].desc); 38 entryHTML += xaraSwidgets_compileTemplate(xaraSwidgets_coinSliderNonav_v8Templates.entry, data[i]); 39 } 40 41 // now lets compile the 'main' template which acts as a wrapper for each entry 42 var mainData = { 43 component_id:divID, 44 entryhtml:entryHTML 45 }; 46 47 var mainTemplate = xaraSwidgets_compileTemplate(xaraSwidgets_coinSliderNonav_v8Templates.main, mainData); 48
49 // now lets apply the resulting HTML for the whole component to the main DIV that was exported by XARA 50 $('#' + divID).html(mainTemplate); 51 52 // work out the required dimensions for width and height. 53 54 var cs2_height = $('#' + divID).parent('div').height() 55 var cs2_width = $('#' + divID).parent('div').width() 56 57 // now we have the components DOM on the page - we can use the 'OuterDiv' as the jquery initiation point 58 $('#' + divID + 'OuterDiv').coinslider({ 59 width: cs2_width, height:cs2_height, effect: 'random', navigation: false // random, swirl, rain, straight 60 }); 61}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.