Simple Machines Community Forum

SMF Support => Bosanski/Hrvatski/Srpski (Bosnian/Croatian/Serbian) => Language Specific Support => Modifikacije => Topic started by: Rcoma01 on November 13, 2007, 08:08:48 AM

Title: Ograničenje pisanja sa velikim slovima
Post by: Rcoma01 on November 13, 2007, 08:08:48 AM
TREBA MI NEŠTO ŠTO ĆE DA ZABRANI KORISNKU DA CEO POST PIŠE VELIKIM SLOVIMA, BAŠ KAO JA SADA !
:D
Ovo me strašno nervira, video sam da postoji nešto što omogućava detekciju velikih slova i kada se primeti da korisnik koristi samo velika slova pojavi se obaveštenje koje ga upozorava da isključi CAPS.
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: MarkoWeb on November 13, 2007, 09:19:01 AM
postoji takav mod za phpbb forum...


#################################################################
## Mod Title:   Type Quietly
## Mod Version: 1.0.1
## Author:      Lars Janssen <[email protected]> - http://www.ukmix.org/
## Description: Gently discourage users from 'shouting' by popping up a Javascript alert
## if they start typing a message or subject in caps.
## (You will need to modify all templates used.)
##
## Installation Level: moderate
## Installation Time:  10 Minutes
## Files To Edit:      1
##                     templates/subSilver/posting_body.tpl
## Included Files:     n/a
#################################################################
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This file contains instructions for modifying the phpBB software
## (not supplied), (C) 2001 The phpBB Group - http://www.phpbb.com/,
## and includes short code excerpts for the purpose of locating change points.
#################################################################
## Author Note:
##
## New in 1.0.1: Fixed erroneous warning after non-alphabetic characters
##
## Only one alert will be displayed while typing/editing a given post.
## This mod doesn't enforce any rules - just provides a helpful hint for newcomers.
## Currently only detects caps when user is typing at the end of the text field.
## Works on most modern browsers, IE 4+, NS 6+; fails gracefully when not supported.
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################

##### - Template alterations - ####
# Directions are given for SubSilver, use as a guide for other templates #

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/posting_body.tpl

#
#-----[ FIND ]------------------------------------------
#

function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

//// Type Quietly ////

// Looks for repeated sequences of uppercase letters being keyed in;
// politely asks user to stop 'shouting'!
// At the moment it only works when the user is typing at the end of the message.
// Should catch most occurrences though.

// Maximum caps in a row (after stripping all non-alphabetical characters)
// Setting this too low may cause it to be triggered by uppercase BBCode/HTML tags
// or acronyms and the like
var TQ_MAX_CAPS = 8;

// Maximum size of text range to sample (should be >= TQ_MAX_CAPS)
var TQ_SAMPLE_SIZE = 16;

// Cutoff point; disable Type Quietly if the message gets long
var TQ_CUT_OFF_POINT = 8192;

// Message to display when user is shouting
var TQ_MESSAGE =
'You seem to be typing in \'all capitals\'.\n\n' +
'This is not usually a good idea: it can make\n' +
'your message harder to read or might indicate  \n' +
'you are \'shouting\'.\n\n' +
'Please make sure Caps Lock is off, and type in\n' +
'mixed or small letters. Thanks!'

// Initialisation: Leave these lines as is
var tqIsActive = true;
var tqPrevEndChars = '';
var tqPrevLength = 0;
var tqPrevElement = '';

// Main Type Quietly function
// Always return true in case some 'clever' browser decides to cancel the keypress
function typeQuietly (textEl, event) {
// Check if active
if (!tqIsActive) {
return true;
}

// Check arguments
if ((typeof textEl != 'object') || (typeof event != 'object')) {
return true;
}

// Check string handling requirements (should be fine for IE 4+, NS 4+ etc.)
if ((typeof RegExp != 'function') || (typeof textEl.value.substr) != 'function') {
return true;
}

// Deactivate if message too long
if (textEl.value.length > TQ_CUT_OFF_POINT) {
tqIsActive = false;
return true;
}

// Check message is long enough to trigger
if (textEl.value.length < TQ_MAX_CAPS) {
return true;
}

// Sample last characters of message
var lastChars = '';
var selectStart, selectLength;
if (textEl.value.length < TQ_SAMPLE_SIZE) {
selectStart = 0;
selectLength = textEl.value.length;
}
else {
selectStart = textEl.value.length - TQ_SAMPLE_SIZE;
selectLength = TQ_SAMPLE_SIZE;
}
lastChars = textEl.value.substr(selectStart, selectLength);

// Check we caught something
if (lastChars.length == 0) {
return true;
}

// If we're now looking at a different element, reset
if ((tqPrevElement == '') || (tqPrevElement != textEl.name)) {
tqPrevEndChars = lastChars;
tqPrevLength = 0;
tqPrevElement = textEl.name;
return true;
}

// End of message must be changing
if (lastChars == tqPrevEndChars) {
return true;
}
tqPrevEndChars = lastChars;

// Last character must itself be a capital
if (lastChars.substr(lastChars.length - 1, 1).search(eval('/[A-Z]/')) == -1) {
return true;
}

// Don't trigger when deleting or on first keypress
if ((tqPrevLength == 0) || (textEl.value.length < tqPrevLength)) {
tqPrevLength = textEl.value.length;
return true;
}
tqPrevLength = textEl.value.length;

// Strip non-alphabetical characters and trim to size
lastChars = lastChars.replace(eval('/[^a-zA-Z]/g'), '');
if (lastChars.length > TQ_MAX_CAPS) {
lastChars = lastChars.substr(lastChars.length - TQ_MAX_CAPS, TQ_MAX_CAPS);
}
else
{
// length doesn't exceed TQ_MAX_CAPS
return true;
}

// Show message if needed
if (lastChars == lastChars.toUpperCase()) {
alert (TQ_MESSAGE);
tqIsActive = false;
}

return true;
}

//// [end of Type Quietly code] ////

#
#-----[ FIND ]------------------------------------------
#

<input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />

#
#-----[ REPLACE WITH ]------------------------------------------
#

<input type="text" name="subject" size="45" maxlength="60" style="width:450px"
tabindex="2" class="post" value="{SUBJECT}" onkeydown="typeQuietly(this, event);" />

#
#-----[ FIND ]------------------------------------------
#

<textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea>

#
#-----[ REPLACE WITH ]------------------------------------------
#

<textarea name="message" rows="15" cols="35" wrap="virtual"
style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);"
onclick="storeCaret(this);" onkeyup="storeCaret(this); typeQuietly(this, event);">{MESSAGE}</textarea>

#
#-----[ SAVE/CLOSE ]------------------------------------------
#
# EoM


Prilagodi ga svojim potrebama :)
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Rcoma01 on November 13, 2007, 09:39:35 AM
Dobra ti fora sa smeškom i ja sam se sit ismejao kad sam video ono sa prilagođenjem.
Odo ja da tražim na engleskom delu valjda je nekome to palo na pamet pre mene.
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: MarkoWeb on November 13, 2007, 10:26:37 AM
Ne znam sta ti je tolko komplikovano... ubacis jedan .js fajl i ubacio deo u texarea i to je to nije komplikovano kao sto izgleda :)
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Rcoma01 on November 13, 2007, 10:43:09 AM
Marko jer to ovo http://www.simplemachines.org/community/index.php?topic=183334.0
ili mod http://custom.simplemachines.org/mods/index.php?mod=869
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: hzxlpmpf on November 13, 2007, 11:40:16 AM
Ovaj mod sto si naveo radi.
Ja sam ga sada isprobao na lokalu i radi.
Ako se pise ovako :
BLABLABLABLA
On prvo pocetno slovo ostavi veliko a sve ostale stavi da su bez caps lock.
Kada to uradi izgleda ovako :
Blablablabla

P.S. : Nefunkcionise u naslovima...
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: MarkoWeb on November 13, 2007, 11:45:18 AM
ne znam sta radi ovaj mod ali ono sto sam ja postavio bi trebalo da izgleda ovako:
Kada neko pise poruku... i ako napise vise od 5 (moze da se menja) velikih slova izbacuje mu poruku...
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: dioda on November 13, 2007, 11:55:28 AM
Ovo sto marko_ kaze sam vidjao na nekim forumima, npr na bureku i dobra je fora skroz, krenes da pises i iskoci prozorce u kom pise prika nema caps lock..
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: MarkoWeb on November 13, 2007, 12:29:03 PM
Koristio sam i ja to nije losa stvar
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Rcoma01 on November 13, 2007, 12:32:38 PM
Ajde da vidimo kako to da integrišemo u SMF, ja bih rado pomogao ali ne znam php.
Jedva se i sa ovim snalazim, jer ima neko da napravi uputstvo pa da sredimo velika slova ?
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: hzxlpmpf on November 13, 2007, 12:52:42 PM
Da.
Da probamo da prepravimo i da okacimo ovde.
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: pikeman on May 29, 2013, 07:38:02 AM
Postoji li alternativa ovom modu za 2.0.4?

http://custom.simplemachines.org/mods/index.php?mod=1518
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Branko. on May 29, 2013, 09:03:05 AM
U kom smislu? Da je kompatibilan?
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Skipper. on May 29, 2013, 01:58:03 PM
Quote from: pikeman on May 29, 2013, 07:38:02 AM
Postoji li alternativa ovom modu za 2.0.4?

http://custom.simplemachines.org/mods/index.php?mod=1518
Ukoliko to pitaš za forum iz tvog profila onda mod radi na 2.0.4.
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: pikeman on May 29, 2013, 03:58:02 PM
Ipak ne radi...

QuoteGreška u instalaciji paketa
Došlo je do najmanje jedne greške prilikom testiranja instalacije ovog paketa...

./Themes/default/GenericControls.template.php
./Themes/default/Post.template.php
./Themes/default/Display.template.php
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Skipper. on May 29, 2013, 05:32:35 PM
Verovatno si vršio neke izmene na temi pa ne prolazi automatska instalacija.
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Branko. on May 30, 2013, 06:37:51 AM
Quote from: pikeman on May 29, 2013, 03:58:02 PM
Ipak ne radi...

QuoteGreška u instalaciji paketa
Došlo je do najmanje jedne greške prilikom testiranja instalacije ovog paketa...

./Themes/default/GenericControls.template.php
./Themes/default/Post.template.php
./Themes/default/Display.template.php

Skoro sam kontaktirao Miloša Ranđelovića koji je autor ove i još nekoliko korisnih modifikacija i dobio saglasnost da ih ažuriram i objavim za nove smf verzije. Ako ti nije hitno, sačekaj da se to završi, objavi i odobri pa da probaš ponovo mada je tačno ovo što Skipper kaže (moralo bi proći).
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: pikeman on May 30, 2013, 06:52:32 AM
Mislim da sam probao na čistoj instalaciji 2.0 i da isto nije prihvatao instalaciju... ne sećam se više.

Sačekaću, nije problem, i ja sam ga pitao davno za apdejt moda ali nema odgovora... http://www.milosrandjelovic.org/smf-modifikacije/allcaps-blocker/

Ovo je vrlo koristan mod, verujem da bi ga mnogo ljudi koristilo da spreči pisanje samo velikim slovima.
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: Branko. on May 30, 2013, 07:43:08 AM
I ja sam poodavno testirao. Mislim da sam nešto mijenjao i da je onda išlo. Probam pa javim rezultate.
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: pikeman on May 30, 2013, 08:31:22 AM
Dogovoreno!
Title: Re: Ograničenje pisanja sa velikim slovima
Post by: pikeman on September 11, 2013, 04:52:19 PM


Ima li li napretka u ažuriranju moda?