Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- /* Editable */
- var campoPerfil = '.psfield';
- var campoPerfilLabel = '.psflabel';
- var campoPerfilContent = '.psfcontent';
- var welcomeMessage = '.welcome-message';
- var pronouns = 'Pronombres';
- var masc = 'Masculinos';
- var fem = 'Femeninos';
- var neut = 'Neutros';
- var mascPronouns = 'o';
- var femPronouns = 'a';
- var neutPronouns = 'e';
- var nullPronouns = '@';
- /* No edites a partir de aquí */
- $(welcomeMessage).each(function(){
- var self = $(this);
- $.get('/u'+_userdata.user_id, function(data) {
- var selected = $(data).find(campoPerfilLabel+':contains('+pronouns+')').parents(campoPerfil).find(campoPerfilContent+' .field_uneditable').text();
- if (selected === masc) {
- var pronounsSelected = mascPronouns;
- } else if (selected === fem) {
- var pronounsSelected = femPronouns;
- } else if (selected === neut) {
- var pronounsSelected = neutPronouns;
- } else {
- var pronounsSelected = nullPronouns;
- }
- $(self).attr('style','--pronoun:"'+pronounsSelected+'";');
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement