Skip to content

Instantly share code, notes, and snippets.

@mms-uret
Last active August 29, 2015 14:17
Show Gist options
  • Save mms-uret/0f554f09ac6ab4e9467c to your computer and use it in GitHub Desktop.
Save mms-uret/0f554f09ac6ab4e9467c to your computer and use it in GitHub Desktop.
RC chochete
<html xmlns='http://www.w3.org/1999/xhtml' >
<head>
<title>Räbe-Chuchi Rezepte v1.3</title>
<script src='jquery-1.11.1.min.js' type='text/javascript'></script>
<script type='text/javascript' src='picnet.table.filter.min.js'></script>
<link rel="stylesheet" href="RCweb.css">
<script>
var initalized = false;
// init filter plugin when DOM ready and after table reload
function readyFn() {
// Initialise
var find1, find2;
var titel1, titel2;
// Initialise Plugin
var grid1 = $('#rezepte');
var options1 = {
filteringRows: function(filterStates) {
grid1.addClass('filtering');
},
filteredRows: function(filterStates) {
grid1.removeClass('filtering');
setRowCountOngrid1();
},
clearFiltersControls: [$('#cleanfilters')]
};
function setRowCountOngrid1() {
var rowcount = grid1.find('tbody tr:not(:hidden)').length;
$('#rowcount').text(rowcount);
}
if (!initialized) {
grid1.tableFilter(options1);
initialized = true;
} else {
grid1.tableFilterRefresh();
}
setRowCountOngrid1();
}
// load table with xml data
function loadXMLDoc1(find1,titel1,find2,titel2)
{
var xmlhttp;
var txt,txt2,skip,x,xx,i,teil;
//set headers
$('#titel1').text(titel1);
$('#titel2').text(titel2);
//adjust xmlhttp to browser
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
txt="";
x=xmlhttp.responseXML.documentElement.getElementsByTagName("qryChocheteRCweb");
for (i=0;i < x.length;i++)
// process xml record
{
txt2="<tr>";
skip=0,
//Datum
xx=x[i].getElementsByTagName("Datum");
{
try
{
teil=xx[0].firstChild.nodeValue.substring(0,10);
txt2=txt2 + "<td class='column1'><a HREF=Rezepte/CH_" + teil + ".pdf>" + teil + "</a></td>";
}
catch (er)
{
txt2=txt2 + "<td class='column1'> </td>";
}
}
//first entry
xx=x[i].getElementsByTagName(find1);
{
try
{
txt2=txt2 + "<td class='column2'>" + xx[0].firstChild.nodeValue + "</td>";
}
catch (er)
//skip record
{
skip=1;
txt2=txt2 + "<td class='column2'> </td>";
}
}
//second entry
xx=x[i].getElementsByTagName(find2);
{
try
{
txt2=txt2 + "<td class='column3'>" + xx[0].firstChild.nodeValue + "</td></tr>";
}
catch (er)
{
txt2=txt2 + "<td class='column3'> </td></tr>";
}
}
if(skip==0)
{
txt = txt + txt2;
}
}
}
$("#cdata").html(txt);
readyFn()
}
xmlhttp.open("GET",'qryChocheteRCweb.xml',true);
xmlhttp.send();
}
$( document ).ready( loadXMLDoc1('Thema','Themen','NameKoeche','leitende Köche') );
</script>
<style type='text/css'>
body {
}
h3 {
font-size:1em;
}
.wrapper {
width:1000px;
margin:0 auto;
}
.header {
width:1000px;
margin-bottom:20px;
padding-bottom:10px;
border-bottom:1px solid #ddd;
}
.content {
font-size:10pt;
clear:both;
}
.header,
.picnet_logo,
.instructions,
}
table,
td,
th {
border: solid 1px silver;
color:#666;
padding:5px;
font-size:10pt;
}
table {
border-collapse:collapse;
width:100%;
}
table tr {
background-color:#eee;
}
table td, table th{
border:1px solid #fff;
float:center;
}
.column1 {
width:10%;
text-align: center;
}
.column2 {
width:55%;
}
.column3 {
width:35%;
}
a {
color:#0079c1;
text-decoration:none;
}
a:hover {
color:#FF0000;
font:bold;
text-decoration:underline;
}
.filtering {
background-color:lightgray;
}
#jqtf_filters {
list-style:none;
}
#jqtf_filters li {
display:inline-block;
position:relative;
float:left;
margin-bottom:20px blackblackblackrgb(240,240,240)
}
.clear {
clear:both
}
hr {
margin-top:20px;
border:1px dotted #eee;
width:640px;
}
#filters {
margin-left:20px;
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='header'>
<div class='instructions'>
<h2><img src="RClogo.jpg" alt="RC">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Räbe-Chuchi Rezepte</h2>
<button onclick="loadXMLDoc1('Thema','Themen','NameKoeche','leitende Köche')">Themen</button>
<button onclick="loadXMLDoc1('Apero','Apéros','TagApero','Apéro tags')">Apéros</button>
<button onclick="loadXMLDoc1('Vorspeise','Vorspeisen','TagVorspeise','Vorspeisen tags')">Vorspeisen</button>
<button onclick="loadXMLDoc1('Hauptspeise','Hauptspeisen','TagHauptspeise','Hauptspeisen tags')">Hauptspeisen</button>
<button onclick="loadXMLDoc1('Beilage','Beilagen','TagBeilage','Beilagen tags')">Beilagen</button>
<button onclick="loadXMLDoc1('Dessert','Desserts','TagDessert','Dessert tags')">Desserts</button>
</div>
</div>
<div class='content'>
<h3><span id='rowcount'></span> Rezepte
<a id='cleanfilters' href='#'>Clear Filters</a></h3>
<table id='rezepte'>
<thead>
<tr style="background-color:#FFDDDD">
<th> Datum</th>
<th id='titel1' width=55%> </th>
<th id='titel2' width=35%> </th>
</tr>
</thead>
<tbody id="cdata">
</tbody>
</table>
</div>
<div class='clear'></div>
<p style="text-align:center">RCweb v1.3</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment