Calling all programming/etc. smarties :D

TappedOut forum

Posted on Jan. 21, 2015, 3:27 p.m. by MagicalHacker

(Not sure who I should ask about this or what type of IT people would be best to ask...)

Hopefully, someone can be of help, but I'm looking to put a sortable table in a deck description, and have no idea even how to find how to find what I'm looking for.

See this website for an example of what I'm looking for.

Any assistance in learning about what I can and cannot do on tappedout would be great.

If tappedout just can't do it, does anyone know a website I can use that can handle something like this for free?

Thanks, and sorry for all the bad lingo, it must be painfully obvious how this is not my forte...

Epochalyptik says... #2

The cited method requires a JavaScript include, which you can't do on TappedOut.

January 21, 2015 3:36 p.m.

Matsi883 says... #3

I thought you could in deck descriptions.

January 21, 2015 3:38 p.m.

rorofat says... #4

If you want it in the deck description, add this to the description:

<table class="sortable" style="width:100%">

<tr>

<td>Jill</td>

<td>Smith</td>

<td>50</td>

</tr>

<tr>

<td>Eve</td>

<td>Jackson</td>

<td>94</td>

</tr>

<tr>

<td>Tim</td>

<td>Taylor</td>

<td>32</td>

</tr>

</table>

as well as this:

<script src="http://www.kryogenix.org/code/browser/sorttable/sorttable.js" type="text/javascript"></script>

Example

Note: Credit goes to here for the js.

January 21, 2015 3:44 p.m.

rorofat says... #5

Also, notice the first 'tr' tag? (the one with jill smith and 50?) That's the title, so it doesn't get sorted.

January 21, 2015 3:45 p.m.

Epochalyptik says... #6

I didn't know that was a thing.

yeaGO, I don't know if that should be a thing.

January 21, 2015 3:58 p.m.

rorofat says... #7

Epoch... I think it should be a thing. There isn't many things you can do with JS, and so far, I've seen a lot of cool things. For instance the Modern Primer's spoiler views are pure JS, as well as the script tag made by scrotality to have the 'other decks' tab on your deck page, as well as the cool sorting (also by scrotality) for the main deck page. As far as I've seen, it's done much more for the sight than it has hurt it.

January 21, 2015 4:14 p.m.

grumbledore says... #8

I've honestly been waiting for that to get shut down. its a definite security hole that so far hasn't been exploited. i think its really cool that yeaGO is basically letting people use it and see how it plays out. that said... someone is going to eventually abuse it and ruin it for everyone else :/

January 21, 2015 4:17 p.m.

rorofat says... #9

Maybe incorporate it as a perk for paid users? (Not the ability to add scripts, just the ability to have the 'My Other Decks' and the deck sorting)...

January 21, 2015 4:20 p.m.

grumbledore says... #10

i think it would be sick to have some kind of system for trusted users to add scripts like that which other people could then use. scripts not on the white list aren't allowed. hell that sounds like a fun project (i work on server platform architecture for my day job, so this kinda speaks to me haha)

January 21, 2015 4:23 p.m.

I work in IT Security. I get leery whenever end users are allowed to mess with HTML or scripts. Some things are fine, but I think implementing the advanced stuff on the back end and the. Letting users have very basic additional capabilities is a much better model.

January 21, 2015 4:29 p.m.

yeaGO says... #12

yeah I've thought about that, just having whitelisted scripts. not really sure how you'd call them or pass parameters :P

anyway, i guess you can just include sortable in your deck description for now.

January 21, 2015 4:32 p.m.

grumbledore says... #13

maybe a pretty basic model would be to use the php pre-processor (I'm assuming this is php [i forget the technically correct term here but I'm figurin that you're picking up what I'm laying down lol]) to just look for script include/other injection methods and parse out the urls. if its not on the whitelist then just remove the url.

January 21, 2015 4:37 p.m.

yeaGO says... #14

so [[script:mtgo-badge username=blah]] or something

January 21, 2015 4:38 p.m.

grumbledore says... #15

yea that would be cool. maybe pass params with [[script:mtgo-badge username=blah params=param1:value, param2:value]]

kinda starts getting into more of a headache for you in terms of exposing/maintaining an set of (mini?) apis around it though

January 21, 2015 4:46 p.m.

rorofat says... #16

So yeaGO did you remove the script support yet?

January 21, 2015 4:48 p.m.

rorofat says... #17

I would be of more assistance, but PHP isn't my forte :) (I'm more asp...)

January 21, 2015 4:50 p.m.

yeaGO says... #18

i haven't removed script support within deck pages.

January 21, 2015 4:52 p.m.

grumbledore says... #19

oof. meant to have {} around the params bit

January 21, 2015 4:54 p.m.

rorofat says... #20

Ok.

Side note: I heard you were looking at text editors for the description boxes... Check out CK Editor... It's free (I think) and has most of the features that people ask about in the forums. (Blah blah blah images blah blah tables blah blah blah link blah blah.)

January 21, 2015 4:55 p.m.

grumbledore says... #21

well he already has jQuery integrated, and people tend to know wiki markup.. why not a jQuery wiki markup component? quick google search returned this. I'm sure theres others that are better. just an example.

January 21, 2015 4:58 p.m.

rorofat says... #22

Ooh that IS nice... I didn't realize he had jQuery...

January 21, 2015 5 p.m.

yeaGO says... #23

yep, you can use it to put scripts on your deck that multiply the load the server has to do by up to 10 times! someone around here knows something about that....

.... ;P

January 21, 2015 5:21 p.m.

grumbledore says... #24

hah if you mean me, then i apologize. didn't expect them to be used by more than a few people at most. i'll look into making them more efficient. might help with load. been meaning to for a while, tbh. kinda rushed/hacked together.

January 21, 2015 5:27 p.m.

yeaGO says... #25

I can just add it as a normal feature I imagine

January 21, 2015 5:34 p.m.

ChiefBell says... #26

The modern format primer does not use javascript. It uses basic html, I believe.

January 21, 2015 5:38 p.m.

TheHroth says... #27

This convo.

My head.

Geddit?

Lolz.

Its over my head! XD

January 21, 2015 5:40 p.m.

rorofat says... #28

ChiefBell: That functionaliy is extremely hard to implement using HTML/CSS alone. Even I (who have been in the coding buisness for years) have had trouble creating a spoiler clicky thing that works using just css and html. I would bet it's either JS, C# (doubtful) or the implementation that comes standard with bootstrap (which is what this website uses). May I ask who designed it?

January 21, 2015 5:56 p.m.

Matsi883 says... #29

You're correct, ChiefBell.

January 21, 2015 5:56 p.m.

Matsi883 says... #30

It's HTML5

January 21, 2015 5:57 p.m.

grumbledore says... #31

damn thats pretty impressive. i had assumed it was all js. checking out the source code now ;)

January 21, 2015 5:57 p.m.

Matsi883 says... #32

January 21, 2015 5:58 p.m.

grumbledore says... #33

derp. didn't know about that tag. tempted to download firefox and see what it looks like on that... but i am loathe to do so

January 21, 2015 6 p.m.

Matsi883 says... #34

It doesn't work on Firefox.

January 21, 2015 6:06 p.m.

ChiefBell says... #35

On Firefox the modern format primer is just a wall of text. The little toggle buttons don't appear. It looks like it's working because there's nothing strange abiut the article - it all looks fine. It's just that you can toggle to show hide text, which isn't so important with the 'back to top' buttons anyway.

January 21, 2015 6:06 p.m.

ChiefBell says... #36

When we first write it matsi and I viewed the primer on like 4 or 5 different browsers just to check for issues. On every browser it's readable.

January 21, 2015 6:08 p.m.

Femme_Fatale says... #37

Why won't you guys use the spoiler I have listed here ChiefBell?

Ack! Run Hans Run! The Slivers Are Coming! It bugs me that you keep using a spoiler that isn't functioning on all browsers.

January 21, 2015 6:19 p.m.

grumbledore says... #38

yea I'm sure it doesnt work - the w3schools article doc that Matsi883 linked specified that. i was just wondering if it looked completely jacked or there was some fall back. wall of text definitely works.

January 21, 2015 6:22 p.m.

ChiefBell says... #39

The other code is way too long and also had some problems of its when I first adopted it. The ppotential benefit just isn't worth the time when you have to type it out about 40 times.

January 21, 2015 6:30 p.m.

ChiefBell says... #40

The other code is way too long and also had some problems of its own when I first adopted it. The ppotential benefit just isn't worth the time when you have to type it out about 40 times.

January 21, 2015 6:30 p.m.

Femme_Fatale says... #41

Control C control V ChiefBell. I can do it for you if you'd like.

January 21, 2015 6:31 p.m.

Matsi883 says... #42

But you have to go through and change the id numbers 40 times.

January 21, 2015 6:34 p.m.

ChiefBell says... #43

Come on femme, don't be patronising. If I remember correctly it was I that originally found and distributed that code to you guys and everyone else. I'm well aware how it works.

The problem is you have to change the numbers in the tag for each new instance. This was unsuitable when we initially wrote the primer because me moved things about constantly. I could do it now but I'm just too busy. Furthermore I believe the arrows look smarter than show / hide in text. But maybe that's me. Trust me though it's a lot more work than it sounds like.

January 21, 2015 6:37 p.m.

Femme_Fatale says... #44

You guys use id numbers? I just use name identifiers. Like what exactly it is. And I work on the card database, something like that certainly doesn't scare me. Hit me up with a pastebin.

January 21, 2015 7:54 p.m.

Matsi883 says... #45

Actually, I asked Cyrrus for the code originally.

Id numbers just take less space to write out and there's less room for spelling mistakes, which is why I use them. But still, you have to go through and change them.

When yeaGO gets rid of JavaScript, your code is going to stop working, femme. Ours will still work.

January 21, 2015 8:02 p.m.

Femme_Fatale says... #46

Wait. WHAT ABOUT MY UPDATE SCROLL BOXES!? I worked so hard on those ;-; even made bullets and everything ...

January 21, 2015 8:16 p.m.

grumbledore says... #47

January 21, 2015 8:18 p.m.

rorofat says... #48

What MagicalHacker is thinking: WTF? JS... Junior scout? This is beyond me... I'll just unsubscribe and see where this goes...

January 22, 2015 9:26 a.m.

MagicalHacker says... #49

This is me right now:

January 22, 2015 12:36 p.m.

grumbledore says... #50

lol that gif is amazing

January 22, 2015 12:39 p.m.

This discussion has been closed