Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
better_formats
Commits
ed5acef2
Commit
ed5acef2
authored
May 31, 2009
by
dragonwize
Browse files
Make javascript match Drupal coding standards.
parent
9822f4ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
better_formats_node_type_form.js
better_formats_node_type_form.js
+16
-16
No files found.
better_formats_node_type_form.js
View file @
ed5acef2
...
...
@@ -12,21 +12,21 @@
/**
* Initialize Better Formats setttings and defaults.
*/
function
better
_f
ormats
_i
nit
()
{
function
better
F
ormats
I
nit
()
{
// Set default settings check for use of global allowed formats.
Drupal
.
settings
.
better
_f
ormats
=
{
"
num
_c
hecked
"
:
$
(
'
input.bf-allowed-formats:checked
'
).
length
};
Drupal
.
settings
.
better
F
ormats
=
{
"
num
C
hecked
"
:
$
(
'
input.bf-allowed-formats:checked
'
).
length
};
// Collapsing the input format setting after the weight columns have been hidden.
$
(
'
.input-format-settings > legend > a
'
).
click
();
// Add hide/show events for allowed formats.
var
format
_b
oxes
=
$
(
'
input.bf-allowed-formats
'
);
format
_b
oxes
.
click
(
function
()
{
better
_f
ormats
_t
oggle
_f
ormats
(
$
(
this
));
var
format
B
oxes
=
$
(
'
input.bf-allowed-formats
'
);
format
B
oxes
.
click
(
function
()
{
better
F
ormats
T
oggle
F
ormats
(
$
(
this
));
});
if
(
Drupal
.
settings
.
better
_f
ormats
.
num
_c
hecked
>
0
)
{
format
_b
oxes
.
each
(
function
()
{
better
_f
ormats
_t
oggle
_f
ormats
(
$
(
this
),
true
);
if
(
Drupal
.
settings
.
better
F
ormats
.
num
C
hecked
>
0
)
{
format
B
oxes
.
each
(
function
()
{
better
F
ormats
T
oggle
F
ormats
(
$
(
this
),
true
);
});
}
}
...
...
@@ -39,9 +39,9 @@ function better_formats_init() {
* @param init
* Boolean value to determine first toggle.
*/
function
better
_f
ormats
_t
oggle
_f
ormats
(
el
,
init
)
{
function
better
F
ormats
T
oggle
F
ormats
(
el
,
init
)
{
// Hide all formats except site default when the first box is checked.
if
(
Drupal
.
settings
.
better
_f
ormats
.
num
_c
hecked
===
0
)
{
if
(
Drupal
.
settings
.
better
F
ormats
.
num
C
hecked
===
0
)
{
$
(
'
select.bf-default-formats option[value != "0"][value != "
'
+
el
.
val
()
+
'
"]
'
).
removeAttr
(
'
selected
'
).
hide
();
}
...
...
@@ -56,22 +56,22 @@ function better_formats_toggle_formats(el, init) {
});
// Do not modify count on intial run.
if
(
!
init
)
{
if
(
!
init
)
{
if
(
el
.
attr
(
'
checked
'
))
{
Drupal
.
settings
.
better
_f
ormats
.
num
_c
hecked
+=
1
;
Drupal
.
settings
.
better
F
ormats
.
num
C
hecked
+=
1
;
}
else
if
(
Drupal
.
settings
.
better
_f
ormats
.
num
_c
hecked
>
0
)
{
else
if
(
Drupal
.
settings
.
better
F
ormats
.
num
C
hecked
>
0
)
{
// Keep num_checked from going below zero.
Drupal
.
settings
.
better
_f
ormats
.
num
_c
hecked
-=
1
;
Drupal
.
settings
.
better
F
ormats
.
num
C
hecked
-=
1
;
}
}
// Show all globally allowed formats if no boxes are checked.
if
(
Drupal
.
settings
.
better
_f
ormats
.
num
_c
hecked
===
0
)
{
if
(
Drupal
.
settings
.
better
F
ormats
.
num
C
hecked
===
0
)
{
// Show global formats available to roles because no format allowed boxes are checked.
$
(
'
select.bf-default-formats option
'
).
show
();
}
}
$
(
document
).
ready
(
better_formats_init
);
\ No newline at end of file
$
(
document
).
ready
(
betterFormatsInit
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment