-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matching Questions and the start of Order Questions #16
base: master
Are you sure you want to change the base?
Changes from 20 commits
6ac6397
d27c553
6118315
0a395e9
16f20aa
6954446
96b6d55
a825f7c
0b520ce
7915c36
a7cab02
b2d5e19
4d3b182
5fbba1e
dbc2234
165bb91
b47197c
c1305d2
2096aff
5dac6e1
1f1f227
bcf4232
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
function tableDraw() | ||
{this.span(); | ||
|
||
var props = ""; | ||
var i = 0; | ||
var dummyRows = this.content.length; | ||
var dummyCols = this.content[0].length; | ||
|
||
var dummyCode = '<table'; | ||
for (prop in this) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Creating global 'for' variable. Should be 'for (var prop ...'. |
||
{if (i >= this.propsLengthPublic) {break;} | ||
dummyCode = dummyCode+' '+prop+'="'+this[prop]+'"';i++; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixed double and single quotes. |
||
} | ||
dummyCode = dummyCode+'>\n'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixed double and single quotes. |
||
|
||
for (var i=1;i<=dummyRows;i++) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'i' is already defined. |
||
{dummyCode = dummyCode+'<tr>\n'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixed double and single quotes. |
||
for (var k=1;k<=dummyCols;k++) | ||
{if (this.content[(i-1)][(k-1)][2] == "false") | ||
{dummyCode = dummyCode+' <td '+this.content[(i-1)][(k-1)][0]+'>'+this.content[(i-1)][(k-1)][1]+'</td>\n';} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
} | ||
dummyCode = dummyCode+'</tr>\n'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixed double and single quotes. |
||
} | ||
|
||
dummyCode = dummyCode+'</table>\n'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixed double and single quotes. |
||
return dummyCode; | ||
} | ||
|
||
function tableSpan() | ||
{var dummyRows = this.content.length; | ||
var dummyCols = this.content[0].length; | ||
|
||
for (var i=1;i<=dummyRows;i++) | ||
{var rowspan = 0;var colspan = 0; | ||
var fromHere = 0;var tillThere = 0; | ||
var myString = ""; | ||
for (var k=1;k<=dummyCols;k++) | ||
{rowspan = 0;colspan = 0; | ||
if (this.content[(i-1)][(k-1)][2] == "false") | ||
{myString = (this.content[(i-1)][(k-1)][0]) + ""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
if (myString.indexOf("colspan") >= 0) | ||
{fromHere = (myString.indexOf("colspan"))+9; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
tillThere = (myString.indexOf('"',fromHere))-1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
if ((fromHere-tillThere) == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use '===' to compare with '0'. |
||
{colspan = myString.charAt(fromHere);} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
else | ||
{colspan = myString.substring(fromHere,tillThere);} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
colspan = parseInt(colspan); | ||
} | ||
if (myString.indexOf("rowspan") >= 0) | ||
{fromHere = (myString.indexOf("rowspan"))+9; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
tillThere = (myString.indexOf('"',fromHere))-1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
if ((fromHere-tillThere) == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use '===' to compare with '0'. |
||
{rowspan = myString.charAt(fromHere);} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
else | ||
{rowspan = myString.substring(fromHere,tillThere);} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
rowspan = parseInt(rowspan); | ||
} | ||
if ((colspan >= 2) && (rowspan <= 1)) | ||
{for (var m=2;m<=colspan;m++) | ||
{this.content[(i-1)][((k-1)+(m-1))][2] = "true";} | ||
} | ||
if ((rowspan >= 2) && (colspan <= 1)) | ||
{for (var m=2;m<=rowspan;m++) | ||
{this.content[((i-1)+(m-1))][(k-1)][2] = "true";} | ||
} | ||
if ((rowspan >= 2) && (colspan >= 2)) | ||
{for (var m=1;m<=rowspan;m++) | ||
{for (var p=1;p<=colspan;p++) | ||
{this.content[((i-1)+(m-1))][((k-1)+(p-1))][2] = "true";} | ||
} | ||
this.content[(i-1)][(k-1)][2] = "false"; | ||
} } } } } | ||
|
||
function tableContent(dummyCols,dummyRows) | ||
{var dummyContent = "["; | ||
for (var i=1;i<=dummyRows;i++) | ||
{dummyContent = dummyContent+"[" | ||
for (var k=1;k<=dummyCols;k++) | ||
{dummyContent = dummyContent+"[['align="+'"left"'+" valign="+'"top"'+"'],[' '],['false']],";} | ||
dummyContent = dummyContent.substring(0,((dummyContent.length)-1)); | ||
dummyContent = dummyContent+"]," | ||
} | ||
dummyContent = dummyContent.substring(0,((dummyContent.length)-1)); | ||
dummyContent = dummyContent+"]"; | ||
return eval(dummyContent); | ||
} | ||
|
||
function tableContentArraysToArguments() | ||
{var dummyRows = this.content.length; | ||
var dummyCols = this.content[0].length; | ||
for (var i=1;i<=dummyRows;i++) | ||
{for (var k=1;k<=dummyCols;k++) | ||
{this.content[(i-1)][(k-1)].props = this.content[(i-1)][(k-1)][0]; | ||
this.content[(i-1)][(k-1)].value = this.content[(i-1)][(k-1)][1]; | ||
this.content[(i-1)][(k-1)].spans = this.content[(i-1)][(k-1)][2]; | ||
} } } | ||
|
||
function tableContentArgumentsToArrays() | ||
{var dummyRows = this.content.length; | ||
var dummyCols = this.content[0].length; | ||
for (var i=1;i<=dummyRows;i++) | ||
{for (var k=1;k<=dummyCols;k++) | ||
{this.content[(i-1)][(k-1)][0] = this.content[(i-1)][(k-1)].props; | ||
this.content[(i-1)][(k-1)][1] = this.content[(i-1)][(k-1)].value; | ||
this.content[(i-1)][(k-1)][2] = this.content[(i-1)][(k-1)].spans; | ||
} } } | ||
|
||
function table() | ||
{var propsDefaultLength = 2; | ||
this.cols = 1; | ||
this.rows = 1; | ||
for (var i=1;i<=table.arguments.length;i++) | ||
{if (table.arguments[(i-1)].indexOf("cols") >= 0) {propsDefaultLength--;} | ||
if (table.arguments[(i-1)].indexOf("rows") >= 0) {propsDefaultLength--;} | ||
eval("this."+table.arguments[(i-1)]); | ||
} | ||
this.propsLengthPublic = (table.arguments.length + propsDefaultLength); | ||
this.propsLengthPrivat = 7; | ||
this.content = tableContent(this.cols,this.rows); | ||
this.span = tableSpan; | ||
this.draw = tableDraw; | ||
this.contentArraysToArguments = tableContentArraysToArguments; | ||
this.contentArgumentsToArrays = tableContentArgumentsToArrays; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed double and single quotes.