User:Glorat

Introduction
I am the author of https://www.boglebot.com - a community approved tool for its international 2-fund portfolio helper.

In this home page, I will perform various wiki experiments

Experiments
Experimental wiki tricks here

Note that this dynamic feature does not work under IE11 (although it would be simply but ugly to support IE11 if needed)

Loading...

Loading...

Installation dependencies
This script has no external dependencies (although the code would be much neater if we had access to Handlebars and lodash)

Widget Javascript
Hidden in this section (do view-source, or edit this section to see the source) is the source code for the widget. It should probably be moved to an actual MediaWiki Widget

function _index(obj,i) {return obj[i]} function lodashGet(obj, path) { return path.split('.').reduce(_index, obj) }

function gen2(rows) { var Html = mw.html; var ths = ['Name', 'Type', 'Ticker'].map(function(h) {return Html.element('th', {class:'headerSort', tabIndex:'0', role: 'columnheader button', title: 'Sort ascending'}, h);}); var trs = rows.map(function(row) {   var cols = [];    cols.push(Html.element('a', {href:'https://www.boglebot.com/quotesdb/' + row.id}, row.name));    ['asset.type', 'ticker'].forEach(function(path) { cols.push(lodashGet(row, path)) });

var tds = cols.map(function(col){return ' ' + col + ' '}); // TODO return ' ' + tds.join('') + ' ' }); var tbody = Html.element('tbody',{}, new Html.Raw(trs.join()));  var thead = ' ' + ths.join() + ' ';  var table = Html.element('table', {class:'dyntable wikitable sortable jquery-tablesorter'}, new Html.Raw(thead + tbody));

return table; }

async function doIt { const url = 'https://asia-northeast1-gainstrack.cloudfunctions.net/fastQuoteSources';

$('.boglebottable').each(function(index, elem) {   const params = {}; // TODO: extract query from the "tag" element of the div so we can pass to the query    const res = $.getJSON(url, params, function(res) { const html = gen2(res.rows); $(elem).html(html); $('table', elem).tablesorter; });

});

}

window.addEventListener('load', function { // mw.loader.using( ['jquery.tablesorter'] ).then( function  { setTimeout(function {     console.log('All assets are loaded');      doIt;    },100 ); })

Pages in development
I'm currently working on the following pages, which are under my username. All wiki editors are welcome to contribute.