Staredit Network > Forums > Staredit Network > Topic: Trigger BBCode
Trigger BBCode
Aug 18 2010, 7:53 pm
By: shmeeps
Pages: < 1 2 3 4 >
 

Aug 20 2010, 9:42 pm DavidJCobb Post #21



Quote from Summary, because my posts are always way too long
If you change a few CSS classes and have the PHP set them instead of the JavaScript, then you can simply use this CSS (which handles the changes) and this JavaScript. The JavaScript in this post is a lot shorter than the one you use. It requires jQuery, but SEN has jQuery, so that's not a problem.

You depend on JS to identify the last item in a tree or subtree; this should be done in the PHP.

If you write "last" as a separate className, and if you write it using PHP, then you can use the CSS and JavaScript below. The CSS is slightly shorter, and the JavaScript is considerably shorter but requires the jQuery library (which we have on SEN, so that's fine).

So for example, instead of writing out something with class="lastopen", you'd write class="last open".

CSS: replace lines 48-67
Code
.sc2 .last, .sc2 .tree.last
{
    background-image: url('Images/Format-Angle.png');
    background-position: 4px 0px;
    background-color: #FFFFFF;
}
.sc2 .collapsed.last
{
    background-image: url('Images/Format-Plus-End.png');
}
.sc2 .open.last
{
    background-image: url('Images/Format-Minus-End.png');
}

(A CSS rule can select an element with a combination of classes. div.foo.bar only matches DIVs with both the class "foo" and the class "bar".)

JavaScript, requires jQuery:
Code
SC2Tree =
  {
     // Allow classnames to be configured in the script
     // in case a class needs to be renamed due to a
     // conflict or something
     classes:
        {
           open: "open",
           collapsed: "collapsed"
        },
     _click:
        function(e) {
           e.stopPropagation(); // we don't want this bubbling up to ancestor LIs.
           var mouseX = e.pageX,
               mouseY = e.pageY;

           // X/Y position of the element on the page.
           var cur = $(this).offset();

           // Ignore clicks that aren't on the "-" and "+" buttons.
           // Probably not good to hard-code the "hitbox" size, but whatever.
           if (mouseY - cur.top > 16 || mouseX - cur.left > 20)
              return;

           // swap the classes
           if ($(this).hasClass(SC2Tree.classes.open))
              $(this).removeClass(SC2Tree.classes.open).addClass(SC2Tree.classes.collapsed);
           else
              $(this).removeClass(SC2Tree.classes.collapsed).addClass(SC2Tree.classes.open);
        },
     init: // sc2tree
        function() {
           // Add the event handler to any LI that contains a sub-list.
           $("div.sc2trigger li:has(ul)").click(this._click);
        }
  };
$(document).ready(function(){SC2Tree.init()}); // initialize when the page loads.


You can then remove the IDs from the div.sc2trigger>ul.sc2. The JavaScript I've posted uses jQuery to locate all div.sc2trigger elements fairly quickly, so the IDs end up being redundant.



None.

Aug 24 2010, 12:30 am payne Post #22

:payne:

Any news? :awesome:



None.

Aug 27 2010, 6:17 am shmeeps Post #23



Update with new linkage ability, when running a trigger through the parser, it will provide you with a clickable link you can copy above the trigger (It says "Trigger (Link, right click and hit "Copy Link Location", and then paste link where ever you need it):"), which you can of course copy and paste wherever you need someone to see what you have posted. Also updated the fonts.

For instance: http://vgshorts.com/BBCode/BBCode3.php?ID=1 will lead to a trigger I posted.

I implemented this as a workaround right now, and also because triggers posted in code boxes will not always copy correctly (it parses tabs as 4 spaces, code boxes seem to render either as 3 spaces, or 4 spaces with one missing. It's weird).

Working on some other stuff as well.



None.

Aug 27 2010, 4:51 pm payne Post #24

:payne:

Quote from shmeeps
Update with new linkage ability, when running a trigger through the parser, it will provide you with a clickable link you can copy above the trigger (It says "Trigger (Link, right click and hit "Copy Link Location", and then paste link where ever you need it):"), which you can of course copy and paste wherever you need someone to see what you have posted. Also updated the fonts.

For instance: http://vgshorts.com/BBCode/BBCode3.php?ID=1 will lead to a trigger I posted.

I implemented this as a workaround right now, and also because triggers posted in code boxes will not always copy correctly (it parses tabs as 4 spaces, code boxes seem to render either as 3 spaces, or 4 spaces with one missing. It's weird).

Working on some other stuff as well.
Woohoo!
But it'd still be a very -very- great thing for this community to get it directly implemented into its site.

Or, isn't there a way to make it appear like an image too?



None.

Aug 27 2010, 11:38 pm DavidJCobb Post #25



Quote from shmeeps
Update with new linkage ability, when running a trigger through the parser, it will provide you with a clickable link you can copy above the trigger (It says "Trigger (Link, right click and hit "Copy Link Location", and then paste link where ever you need it):"), which you can of course copy and paste wherever you need someone to see what you have posted. Also updated the fonts.

For instance: http://vgshorts.com/BBCode/BBCode3.php?ID=1 will lead to a trigger I posted.

I implemented this as a workaround right now, and also because triggers posted in code boxes will not always copy correctly (it parses tabs as 4 spaces, code boxes seem to render either as 3 spaces, or 4 spaces with one missing. It's weird).

Working on some other stuff as well.
Bug. If an item doesn't have a collapse box, then clicking next to it (where the collapse box would be shown, if there was one) will collapse the item's parent.



None.

Aug 28 2010, 2:26 am payne Post #26

:payne:

Just wondering: is the actual code SEN-friendly enough to simply be copy-pasted with very very very few changes/tweaks? :O



None.

Aug 28 2010, 2:28 am DavidJCobb Post #27



Quote from payne
Just wondering: is the actual code SEN-friendly enough to simply be copy-pasted with very very very few changes/tweaks? :O
Not certain. If he uses the code alterations I proposed, it may be easier to implement. I know that SEN uses the "collapsed" className for something, but I don't know what or how offhand; if it's anything other than "display:none", it could interfere with his code.



None.

Aug 28 2010, 4:37 am shmeeps Post #28



As far as classes go, i can rename whatever to make it compatible. I've looked at your code but I haven't had a chance to sit down and implement it.



None.

Aug 28 2010, 4:51 am DavidJCobb Post #29



Well, lemme check...

That's odd... Tests in Firebug show that the "collapsed" class is unused, though I have been given information to the contrary by Devourer...

I guess the most reasonable test would be for me to copy some of the HTML your script generates, and use Firebug to test how it'd look in a post on SEN. Should be easy, but it's 1AM and I'm a lazy bastard, so I'll get to it later. :P



None.

Aug 28 2010, 5:57 am payne Post #30

:payne:

Devourer... you mind getting a bit involved in this topic? :awesome:



None.

Aug 28 2010, 7:10 am DevliN Post #31

OVERWATCH STATUS GO

Considering he hasn't posted in the thread yet, you'd think there would be an easier way to ask him. Like, say, a PM...



\:devlin\: Currently Working On: \:devlin\:
My Overwatch addiction.

Aug 28 2010, 11:57 am Devourer Post #32

Hello

I keep reading many many stuff on SEN, especially this forum, as this somewhat... is mine forum :bleh:
However, I already feel guilty and unreliable, but I still don't feel like coding



Please report errors in the Staredit.Network forum.

Aug 28 2010, 4:05 pm DavidJCobb Post #33



Quote from Devourer
However, I already feel guilty and unreliable, but I still don't feel like coding
Ha, same 'ere, man, but I don't even have an excuse. My, eh, psychological troubles actually ended a few days ago, but my motivation's still shot.



None.

Aug 28 2010, 8:04 pm payne Post #34

:payne:

Quote from DevliN
Considering he hasn't posted in the thread yet, you'd think there would be an easier way to ask him. Like, say, a PM...
I was 100% sure he was reading this topic already. ;)
Don't forget I love to poke Devourer about undone stuff all around SEN. :><:



None.

Aug 28 2010, 9:21 pm shmeeps Post #35



Updated, with COLORS! Also included a few action categories that slipped under my nose last time. Hopefully I can add in your changes a bit later today.

Also, if you guys need some help coding, I'd be happy to lend a hand. I might not be a virtuoso coder, but I might be useful here and there.



None.

Aug 28 2010, 9:23 pm Devourer Post #36

Hello

Shmeeps, I got to admit that I like the effort you put into SEN, however, implementing this can take some time, so please be patience. Sorry.



Please report errors in the Staredit.Network forum.

Sep 8 2010, 5:25 pm payne Post #37

:payne:

http://starcraftmapping.de/gui.php
I have found this. Not as practical and polished as your, shmeeps, but still demonstrates how useful this would be for this community. :)

Find new coder and implement gogo! :awesome:



None.

Sep 15 2010, 11:44 am Ahli Post #38

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Cool. That thing even works with localized trigger language.
http://vgshorts.com/BBCode/BBCode3.php?ID=104

But it has problems with the trigger name "damage++ for each kill".




Sep 15 2010, 2:31 pm payne Post #39

:payne:

It has a problem with variables as well.
If you Copy As Text a variable, it will show it as a Trigger or something like that. ;o



None.

Sep 15 2010, 4:16 pm shmeeps Post #40



Quote from Ahli
Cool. That thing even works with localized trigger language.
http://vgshorts.com/BBCode/BBCode3.php?ID=104

But it has problems with the trigger name "damage++ for each kill".
Hmm, interesting. It's supposed to take any empty string and allow that for the name, I've only seen that happen if the name didn't exist. I'll take a look into it.

Quote from payne
It has a problem with variables as well.
If you Copy As Text a variable, it will show it as a Trigger or something like that. ;o
If you just copy the action? This is probably due to it having to find an "Action" Header before it starts rendering actions and an actual action, otherwise it will try to process them as a generic trigger or trigger name. It's possible to render a trigger without a name, but not a condition/event/variable/action without the proper header.



None.

Options
Pages: < 1 2 3 4 >
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:05 pm]
Ultraviolet -- :wob:
[03:55 pm]
Zoan -- :wob:
[10:34 am]
NudeRaider -- SEN doesn't rely on spammers initiate its sleep cycle. It hat fully automated rest and clean-up phases. Please understand that this is necessary for the smooth operation of the site. Thank you.
[2024-5-18. : 3:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[2024-5-17. : 6:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[2024-5-17. : 5:41 am]
Ultraviolet -- 🤔 so inf is in you?
[2024-5-17. : 4:57 am]
O)FaRTy1billion[MM] -- my name is mud
[2024-5-17. : 4:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
[2024-5-16. : 8:36 pm]
Ultraviolet -- Inf, we've got a job for you. ASUS has been very naughty and we need our lil guy to go do their mom's to teach them if they fuck around, they gon' find out
Please log in to shout.


Members Online: Roy, O)FaRTy1billion[MM]