User:Yitzi/wikia.js

/* */ /* */ $('.DBQuery').each(function { var lines = $(this).text.split(($(this).text.indexOf('\r') != -1) ? '\r' : '\n'); var database = ; var formId = ; var resultId = ''; var properties = ["test", "test2"]; var entries = []; // Parse config for (var i in lines)  {  var temp = lines[i].split('=', 2);  if (temp.length != 2)     {    continue;    }  switch ($.trim(temp[0]))     {    case 'database':      database = ($.trim(temp[1]));      break;    case 'form':    formId = ($.trim(temp[1]));      break;    case 'result':      resultId = ($.trim(temp[1]));      break;    }  }

//Now to construct the list of entries fulfilling a particular query: function query(queryentries,modes,allownones) { alert (properties); } //Next, a constructor function to create a new table-containing div. function DBtablediv(name,tableentries) { this.testproperty="test"; } //And now to make the actual query form.

var $queryTable=$(' ').addClass('wikitable jcTable'); for (var i in properties) { var $tr = $(' '); $tr.attr(id,properties[i]); $tr.append(' '+properties[i]+ );

$queryTable.append($tr); } $form = $(' ').attr({'action': '#', 'id': 'jcForm' + formId}).submit(function {  queryentries=[];  modes=[];  allownones=[];  newEntries=query(queryentries,modes,allownones);  new DBtablediv(queryName.value,newEntries);  }); $form.append($queryTable); $form.append(' '); $form.append('Name for query-results table:'); var queryName=document.createElement("input"); queryName.type="text"; $form.append(queryName); $form.append($(' ').attr({type: 'submit', value: 'Submit'})); $('#bodyContent #' + formId + ',#WikiaArticle #' + formId).empty.append($form); }); /* */ /* */