Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Nao
9646
Added support for multiple levels of tags...

Code: [Select]
// Is there an opened quote tag here?
var selection = this.value.substring(0, selectionStart), lcs = selection.toLowerCase();
var quotes = lcs.match(/\[quote.*?\]/g), unquotes = lcs.match(/\[\/quote\]/g);
if (quotes === null || (unquotes !== null && quotes.length <= unquotes.length))
return true;
var num = quotes.length - (unquotes === null ? 0 : unquotes.length) + 1;

surroundText(new Array(num).join('[/quote]') + '\n', '\n\n' + new Array(num).join('[quote]'), this);

The 'join' thing is the equivalent of str_repeat. Pretty neat... (Took the idea from php.js)
It still won't deal with things that are cut in the middle, like code tags or even anchors or whatever. Dunno if it's that important... Is it? Also, it no longer reproduces the earlier quote variables (author, date). Adding them back would probably be a bit complicated... (I can't just use a list of the last quotes in the array... If I have a self-closed quote right before my post, it will get crazy and reproduce that quote's data instead of the correct one.)
9647
Quote from Arantor on March 12th, 2011, 07:02 PM
Well, there is favour for the inline-deleted style.
I had that feeling, too... And I had the feeling that since it's 'my side', I'm going to have to do the implementation myself eheh... :P
Quote
My principle concern was the UI for it (though permissions are tricky, too) in which case if we mock up how the UI looks we can get a sense of whether that needs fixing or not.
I'd rather have as little extra UI as possible...
9648
So... What do we do with the recycled board? :^^;:
9649
My, my... It's working pretty well. And with a relatively short function. And without a single regex involved, ahah. (I originally had one.)

Added this in editor.js (the splitQuote registration):

Code: [Select]
$(this.oTextHandle).keydown(this.aEventWrappers.shortcutCheck).keydown(splitQuote);

And then this in post.js:

Code: [Select]
// Split a quote if we press Enter inside it.
function splitQuote(oEvent)
{
// Did we just press Enter?
if (oEvent.which != 13)
return true;

// Where are we, already?
if ('selectionStart' in this)
var selectionStart = this.selectionStart;
else
{
var range = document.selection.createRange(), stored_range = range.duplicate();
dul.moveToElementText(this);
dul.setEndPoint('EndToEnd', range);
var selectionStart = dul.text.length - range.text.length;
}

// Is there an opened quote tag here?
var selection = this.value.substring(0, selectionStart), lcs = selection.toLowerCase(), lioQuote = lcs.lastIndexOf('[quote');
if (lioQuote <= lcs.lastIndexOf('[/quote'))
return true;
var quote = '\n\n' + selection.substring(lioQuote);

surroundText('[/quote]\n', quote.substring(0, quote.indexOf(']') + 1), this);

return true;
};

Can you give it a try, Pete? I tested in many possible ways but I'm sure you'll be interested in seeing it for yourself.
Also, I'm readding the original quote with author and time, but I think it'd be smarter to add something like[quote continued], where we would make it clear that this quote is a continuation of the previous one.

NB: it doesn't work on nested quotes, I fear... Maybe you can find a workaround, like counting the number of quotes and the number of /quotes and generating the splitter quotes based on the difference between them... That might work.
9650
I have no idea.... Google says there's a "Split quote" bookmarklet for vB, but it simply splits every paragraph into its own quote, at the beginning. That's an interesting approach but to me it sounds like a wrong one, if only because of the potential waste of space if the user doesn't modify anything at all and just answers at the beginning of their post.

Anyway... Currently working on implementing that 'splitQuote' function. And of course, my implementation is ugly... What matters is to make it work, for now. I think I can be done before tonight but I have to go right now. A Jane Austen movie to watch...
9651
Quote from Arantor on March 12th, 2011, 02:04 AM
Certainly sounds heavy, am curious to see it thought.

Hang on, why aren't you in bed?! :P
Tron marathon in hd yesterday with friends. (the first one was so boring! Hate ya Wendy Carlos. My childhood memories were raped.)
9652
Considering I wanted to do that for >... why didn't I think of that for quote rags? Eheh. I'll try to see into it.
9653
Finished doing my first 'working' version of the parser... It only parses TO mail format, not FROM it for now.

Stats: 45 lines of code, 1 preg_match_all, 2*words preg_match, 4*words westr::strlen, 2 explode (1 per line), 1 str_replace per line. Heavy, eh....? Couldn't do any better... But it's still pretty fast and it's nestable.
9654
Other software / Re: Well the deed is done
« on March 11th, 2011, 03:42 PM »
Quote from Arantor on March 11th, 2011, 03:35 PM
It's better than the one paid offering on SMF *shrug*
Well... Technically, AeMe2 is still available over there... (I can't make the switch without fixing PayPal subscriptions. And, well... I'm too busy on other things, and apparently you don't want to bother about it either :P)
Quote
vBulletin isn't inherently bad software, there is a reason it became the 'go to' forum of choice. It's just not what it could be.
The feature set is impressive (on their website). And it does say "picture gallery" which is why I'm surprised someone would be using Photopost at all... It's just that it's too 'busy'. And the database templates, from what you described. And so many poor UI and design decisions... It makes me cringe. It's nearly funny that they actually increased their price for something that was inferior to the already not so exciting v3.

But technically, I would have much of the same complaints about XenForo. Selling some software for $100 on beta release day, eh? Making their beta testers pay to work for them...? And overall -- $140 or $280, whatever -- it's too expensive for what it is. Heck, to me WordPress is the de facto blog software (..not for long :niark:), but there isn't a single de facto forum package. Wedge shall be the one -- the feature set of the paid competition, some extra features that no one has (it's really the only reason I'm getting lost in old-timer quotes...), and the best price of all.
But don't ask me to support the software though. I'll leave it to others.
9655
Features / Re: New revs
« on March 11th, 2011, 03:09 PM »
rev 652
(2 files, 7kb) -- just so that I can focus on other things...

* Removed $ent_list and $ent_check variables from westr (not used), and replaced them with $can_mb, which determines whether mb_* functions are supported. Maybe it's slower than an is_callable, I don't know, I don't care. (Class-String.php)
* Force UTF-8 encoding on mb_* functions. Just wanted to point out that UTF-8 is not always the default charset in mb functions. (Class-String.php)
! Fixed an undefined index in westr::strpos(). (Class-String.php)
* Made westr::strlen() about 3 times faster by saving an extra round of preg_replace and using mb_strlen if available. (Class-String.php)
* Tweak on poll option margins. (sections.css)
9656
Other software / Re: Well the deed is done
« on March 11th, 2011, 01:59 PM »
Quote from DirtRider on March 11th, 2011, 12:28 PM
most forum owners are more than happy to pay for this one http://www.photopost.com/why-vbgallery.html
"most forum owners" are stupid...
9657
Quote from Arantor on March 9th, 2011, 11:48 PM
Hmm. OK, well, we already know what is newline delineated because we're given newlines by the editor and they're still present in the message body. So it's not like we're totally devoid of that meaning.
That's the basics... Obviously it gets more complicated because of 5 things:
- Cutting lines that are longer than an arbitrarily decided length. I think around 80 chars would be logical, but smaller screens will show them in two lines... Whatever. Can live with that uh. Most likely these screens are on mobile -- and you know how dealing with quotes is horrible on mobile screens. The > solution is actually a great step in usability for these. (Select a line, press Return, type answer...)
- wordwrap() doesn't work on UTF, ah ah. So I have to do it differently, getting all lines that are longer than 80 chars and splitting them manually.
- words that are too long: it's relatively easy to split them to the next line... But how do we put them back together at posting time?
- tags: same here...
- how do we differentiate between line breaks that are due to long lines, and line breaks that were in the original? I thought that it could be solved by telling the editor that a 50-char line (or smaller) means a real line-break while more is a normal line. But of course, it would be too easy -- because of the aforementioned tag & long word problems, it's never easy to determine that kind of thing...
Quote
We can easily use that to define blocks of text that should be indicated with >>... but without using JS there's no way to display it.
I haven't been using JS because it can be done with PHP and JS would only complicate things. (I'm thinking this feature will only be on non-Wysiwyg anyway. I don't care -much- about Wysiwyg and Wysiwyg users probably don't even know what a non-HTML e-mail is...)
Quote
Part of me things we should just treat it as a single block of text, stick it in a paragraph tag and attach a coloured left border to it the way some email clients do. That way you essentially leave layout to the client to deal with ;)
That would mean using a contentEditable frame instead of a textarea, if you want to add coloring inside the area...
9658
Spent the better part of the day thinking of implementations for this...
Especially after I did something similar in Class-CSS.php (nested rules), I thought it'd be easy.

Well... It isn't. The basics work, I tested and everything. But because I tested, I also found many, many flaws.
For instance, how do we differentiate between a newline, and a line that is simply too long and must be split over two lines? How do we make sure lines don't get longer than the available textarea width? How do we treat anything that is between tags and split over several lines? (e.g. if you have a link with a description that takes over two lines, should we cut the line at all, or close the link at the end of the first line and reopen the same link automatically at the beginning of the next one? Things like that...)

Every time I think of a workaround for a problem, I discover another weakness somewhere else.
So, basically -- it's pretty hard to have both a BBCode system, and an e-mail style quote system.

Any thoughts...? Going to bed. Maybe I'll be more capable of thinking tomorrow.
9659
Features / Re: New revs
« on March 8th, 2011, 07:53 PM »
rev 649
(30 files, 33kb... All done manually and double-checked at commit time >_<)

- Replaced all <label for="..."> occurrences with just <label> whenever it was possible. (install.php, Display.php, Profile.php, Subscriptions-PayPal.php, SSI.php, TEMPLATES: Admin, Display, ManageBans/Boards/Maintenance/Membergroups, ManageMembers/News/Paid/Search/Smileys, Memberlist, ModerationCenter, MoveTopic, Packages, PersonalMessage, Poll, Post, Profile, Register, Reminder, Reports, Search, SplitTopics, Themes)

NB: I removed the associated id in a minority of cases -- stopped when it proved too dull to do as I had to check whether JavaScript used these ids at all. Sounds like a job half done, but... 'screw you, I'm going home.' All I can say is that it's best to remove the id in loops (I tried to do it as much as possible), and in pages that get visited often. (Didn't look hard for these, though. But I know the setting pages in the profile area don't seem to use the id's too much. Or at all. Still -- I'm done. Too boring!)

:edit: I also didn't touch some of the 'other' folder's files. Too boring, once again, for files we may not even keep...
9660
Features / Re: New revs
« on March 8th, 2011, 03:16 PM »
rev 648
(8 files, 15kb)

* Plenty of fixes, simplifications and optimizations for string-related functions. (Class-String.php)[1]
* Rewrote string cutter to: fix strlen/substr when mb_* functions aren't available, fix mb_* when available (forgot to force them to UTF), and avoid cutting the ellipsis in half with a soft hyphen. Yes, it was possible to do that... Uh. (Class-String.php)
* Renamed {query_see_only_board} to {query_list_board} and {query_wanna_see_only_board} to {query_wanna_list_board}, and related variables. It means 'make sure the board can be listed', as opposed to not only listed, but also browsed. (Load.php)
! Added query_wanna_see_board to ssi_topTopics() for very large boards. If performance is an issue... Just don't use SSI, all right? (SSI.php)
* Replaced operator/notoperator with proper >/< signs. Saves a bit of processing time... (Display.php)
* Made the category collapse image stylable. (Subs-BoardIndex.php, sections.css)
* French translation tweak. (index.french.php)
* Single-byte-nazi. (Class-Editor.php)
 1. Pete, if you're unsure about any of these, feel free to ask and I'll explain my changes ;)