Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soft_length_limit
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
soft_length_limit
Commits
e12dabc8
Commit
e12dabc8
authored
12 years ago
by
Jakob Lau Nielsen
Browse files
Options
Downloads
Patches
Plain Diff
Altered the look of the soft limit alert counter
parent
61541a71
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
soft_length_limit.js
+7
-8
7 additions, 8 deletions
soft_length_limit.js
with
7 additions
and
8 deletions
soft_length_limit.js
100644 → 100755
+
7
−
8
View file @
e12dabc8
...
...
@@ -27,8 +27,7 @@
// Preparing the input elements by adding a tooltip container.
$
(
'
.soft-length-limit
'
).
each
(
function
(
index
){
var
$parent
=
$
(
this
).
parent
();
$parent
.
css
(
'
position
'
,
'
relative
'
);
$parent
.
append
(
'
<div class="soft-length-limit-tooltip"></div>
'
);
$
(
this
).
before
(
'
<div class="soft-length-limit-tooltip description"></div>
'
);
$element
=
$
(
this
);
// Used for automatically moving the tooltip when resizing the
...
...
@@ -52,14 +51,13 @@
var
bottom
=
top
+
$
(
this
).
outerHeight
(
true
);
var
right
=
left
+
$
(
this
).
outerWidth
(
true
);
$
(
this
).
trigger
(
'
textchange
'
,
$
(
this
).
val
());
$tooltip
.
css
(
'
left
'
,
0
).
css
(
'
top
'
,
bottom
+
10
).
css
(
'
position
'
,
'
absolute
'
);
$tooltip
.
fadeIn
(
'
fast
'
);
$tooltip
.
slideDown
(
'
fast
'
);
});
// Hides the tooltip.
$
(
'
.soft-length-limit
'
).
blur
(
function
(
event
){
var
$tooltip
=
$
(
this
).
parent
().
find
(
'
.soft-length-limit-tooltip
'
);
$tooltip
.
fadeOut
(
'
fast
'
);
$tooltip
.
slideUp
(
'
fast
'
);
});
// Shows the relevant info to the user in the tooltip.
...
...
@@ -83,19 +81,20 @@
}
if
(
val
.
length
===
0
)
{
$tooltip
.
html
(
Drupal
.
t
(
'
Should contain max. <strong>@limit</strong>
characters.
'
,{
$tooltip
.
html
(
Drupal
.
t
(
'
Content limited to @limit
characters.
'
,{
'
@limit
'
:
limit
}));
}
else
if
(
remaining
<
0
)
{
$tooltip
.
html
(
Drupal
.
t
(
'
<strong>@limit</strong>
character limit exceeded by
<strong>@exceed</strong>
characters
'
,{
$tooltip
.
html
(
Drupal
.
t
(
'
@limit
character limit exceeded by
@exceed
characters
.
'
,{
'
@limit
'
:
limit
,
'
@exceed
'
:
-
remaining
}));
}
else
{
$tooltip
.
html
(
Drupal
.
t
(
'
<strong>@remaining</strong> characters left
'
,{
$tooltip
.
html
(
Drupal
.
t
(
'
Content limited to @limit characters. Remaining: @remaining
'
,{
'
@limit
'
:
limit
,
'
@remaining
'
:
remaining
}));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment