Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

Donate!

pls donate


#1 2017-07-10 16:20:25

Tomahawk
Forum Mod
From: BiH
Joined: 2015-02-18
Posts: 2,185

Shortcuts for BBcode

Is it possible?

Could I highlight some text in a post, hit Alt + I or something and see that highlighted text magically surrounded by BBcode italics, thus saving me the effort of using the mouse while writing a long post?


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

Wooted by:

#2 2017-07-10 16:27:39

HeyNK
Member
Joined: 2017-04-07
Posts: 1,318

Re: Shortcuts for BBcode

Probably could use a macro if you're a full time forum user.

Offline

#3 2017-07-10 16:34:08

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,795

Re: Shortcuts for BBcode

$("textarea").keypress("",function(e) {
  if (e.altKey && e.key == 'i'){
    insert_text('[i]', '[/i]');
  }
});

here you go (I should probably add the others huh)

Offline

#4 2017-07-10 16:38:49

Tomahawk
Forum Mod
From: BiH
Joined: 2015-02-18
Posts: 2,185

Re: Shortcuts for BBcode

^ What am I supposed to do with that?

I use Edge. https://wiki.everybodyedits.com/images/d/d1/022_coy


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#5 2017-07-10 16:40:38, last edited by hummerz5 (2017-07-11 03:47:59)

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,795

Re: Shortcuts for BBcode

get a different browser, I guess :b

or beg diff to add something like it. Currently your option is to go into the console and paste that in. Or make it a bookmarklet

edit:

I added ugly support for all buttons:

$("textarea").keypress("",function(e) {
  var hotkeys = ['b', 'i', 'u', 's', 'h', '`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-' ,'='];
  var index = hotkeys.indexOf(e.key);
  if (e.altKey && index != -1){
    $("#bbcodebar").children()[index].click();
  }
});

Problem is, which keys do you give to which buttons? there's 17!

Offline

hummerz51499701238667216

Board footer

Powered by FluxBB

[ Started around 1571773300.0181 - Generated in 0.023 seconds, 12 queries executed - Memory usage: 1.3 MiB (Peak: 1.41 MiB) ]