Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
306
Merge Requests
306
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
f24396f3
Commit
f24396f3
authored
Aug 29, 2012
by
ACF
Committed by
tim.plunkett
Oct 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1758562
by ACF, dawehner | aspilicious: Cleanup javascript to use strict and '==='.
parent
1f0ac8aa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
260 additions
and
127 deletions
+260
-127
js/ajax.js
js/ajax.js
+10
-8
js/ajax_view.js
js/ajax_view.js
+4
-2
js/base.js
js/base.js
+94
-92
js/jquery.ui.dialog.patch.js
js/jquery.ui.dialog.patch.js
+3
-0
js/views-admin.js
js/views-admin.js
+141
-21
js/views-contextual.js
js/views-contextual.js
+2
-0
js/views-list.js
js/views-list.js
+6
-4
No files found.
js/ajax.js
View file @
f24396f3
...
...
@@ -4,6 +4,8 @@
*/
(
function
(
$
)
{
"
use strict
"
;
Drupal
.
ajax
.
prototype
.
commands
.
viewsSetForm
=
function
(
ajax
,
response
,
status
)
{
var
ajax_title
=
Drupal
.
settings
.
views
.
ajax
.
title
;
var
ajax_body
=
Drupal
.
settings
.
views
.
ajax
.
id
;
...
...
@@ -38,7 +40,7 @@
Drupal
.
ajax
.
prototype
.
commands
.
viewsDismissForm
=
function
(
ajax
,
response
,
status
)
{
Drupal
.
ajax
.
prototype
.
commands
.
viewsSetForm
({},
{
'
title
'
:
''
,
'
output
'
:
Drupal
.
settings
.
views
.
ajax
.
defaultForm
});
$
(
Drupal
.
settings
.
views
.
ajax
.
popup
).
dialog
(
'
close
'
);
}
}
;
Drupal
.
ajax
.
prototype
.
commands
.
viewsHilite
=
function
(
ajax
,
response
,
status
)
{
$
(
'
.hilited
'
).
removeClass
(
'
hilited
'
);
...
...
@@ -92,7 +94,7 @@
*/
Drupal
.
theme
.
tableDragChangedWarning
=
function
()
{
return
[];
}
}
;
/**
* Trigger preview when the "live preview" checkbox is checked.
...
...
@@ -105,7 +107,7 @@
}
});
}
}
}
;
/**
* Sync preview display.
...
...
@@ -120,7 +122,7 @@
$
(
"
#views-live-preview #preview-display-id
"
).
val
(
display_id
);
}).
addClass
(
'
views-ajax-processed
'
);
}
}
}
;
Drupal
.
behaviors
.
viewsAjax
=
{
collapseReplaced
:
false
,
...
...
@@ -164,7 +166,7 @@
var
element_settings
=
base_element_settings
;
// Set the URL to go to the anchor.
element_settings
.
url
=
$
(
this
).
attr
(
'
href
'
);
if
(
Drupal
.
Views
.
getPath
(
element_settings
.
url
).
substring
(
0
,
21
)
!=
'
admin/structure/views
'
)
{
if
(
Drupal
.
Views
.
getPath
(
element_settings
.
url
).
substring
(
0
,
21
)
!=
=
'
admin/structure/views
'
)
{
return
true
;
}
...
...
@@ -187,7 +189,7 @@
var
element_settings
=
base_element_settings
;
// Set the URL to go to the anchor.
element_settings
.
url
=
$
(
this
.
form
).
attr
(
'
action
'
);
if
(
Drupal
.
Views
.
getPath
(
element_settings
.
url
).
substring
(
0
,
21
)
!=
'
admin/structure/views
'
)
{
if
(
Drupal
.
Views
.
getPath
(
element_settings
.
url
).
substring
(
0
,
21
)
!=
=
'
admin/structure/views
'
)
{
return
true
;
}
...
...
@@ -202,8 +204,8 @@
if
(
!
this
.
collapseReplaced
&&
Drupal
.
collapseScrollIntoView
)
{
this
.
collapseReplaced
=
true
;
Drupal
.
collapseScrollIntoView
=
function
(
node
)
{
for
(
var
$parent
=
$
(
node
);
$parent
.
get
(
0
)
!=
document
&&
$parent
.
size
()
!
=
0
;
$parent
=
$parent
.
parent
())
{
if
(
$parent
.
css
(
'
overflow
'
)
==
'
scroll
'
||
$parent
.
css
(
'
overflow
'
)
==
'
auto
'
)
{
for
(
var
$parent
=
$
(
node
);
$parent
.
get
(
0
)
!=
=
document
&&
$parent
.
size
()
!=
=
0
;
$parent
=
$parent
.
parent
())
{
if
(
$parent
.
css
(
'
overflow
'
)
==
=
'
scroll
'
||
$parent
.
css
(
'
overflow
'
)
=
==
'
auto
'
)
{
if
(
Drupal
.
viewsUi
.
resizeModal
)
{
// If the modal is already at the max height, don't bother with
// this since the only reason to do it is to grow the modal.
...
...
js/ajax_view.js
View file @
f24396f3
...
...
@@ -4,6 +4,8 @@
*/
(
function
(
$
)
{
"
use strict
"
;
/**
* Attaches the AJAX behavior to Views exposed filter forms and key View links.
*/
...
...
@@ -30,7 +32,7 @@ Drupal.views.ajaxView = function(settings) {
var
ajax_path
=
Drupal
.
settings
.
views
.
ajax_path
;
// If there are multiple views this might've ended up showing up multiple times.
if
(
ajax_path
.
constructor
.
toString
().
indexOf
(
"
Array
"
)
!=
-
1
)
{
if
(
ajax_path
.
constructor
.
toString
().
indexOf
(
"
Array
"
)
!=
=
-
1
)
{
ajax_path
=
ajax_path
[
0
];
}
...
...
@@ -124,7 +126,7 @@ Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status
// more complex such as a modal popup. Recurse up the DOM
// and scroll the first element that has a non-zero top.
var
scrollTarget
=
response
.
selector
;
while
(
$
(
scrollTarget
).
scrollTop
()
==
0
&&
$
(
scrollTarget
).
parent
())
{
while
(
$
(
scrollTarget
).
scrollTop
()
==
=
0
&&
$
(
scrollTarget
).
parent
())
{
scrollTarget
=
$
(
scrollTarget
).
parent
();
}
// Only scroll upward
...
...
js/base.js
View file @
f24396f3
...
...
@@ -4,107 +4,109 @@
*/
(
function
(
$
)
{
Drupal
.
Views
=
{}
;
"
use strict
"
;
/**
* jQuery UI tabs, Views integration component
*/
Drupal
.
behaviors
.
viewsTabs
=
{
attach
:
function
(
context
)
{
if
(
$
.
viewsUi
&&
$
.
viewsUi
.
tabs
)
{
$
(
'
#views-tabset
'
).
once
(
'
views-processed
'
).
viewsTabs
({
selectedClass
:
'
active
'
});
}
Drupal
.
Views
=
{};
$
(
'
a.views-remove-link
'
).
once
(
'
views-processed
'
).
click
(
function
(
event
)
{
var
id
=
$
(
this
).
attr
(
'
id
'
).
replace
(
'
views-remove-link-
'
,
''
);
$
(
'
#views-row-
'
+
id
).
hide
();
$
(
'
#views-removed-
'
+
id
).
attr
(
'
checked
'
,
true
);
event
.
preventDefault
();
});
/**
* Here is to handle display deletion
* (checking in the hidden checkbox and hiding out the row)
*/
$
(
'
a.display-remove-link
'
)
.
addClass
(
'
display-processed
'
)
.
click
(
function
()
{
var
id
=
$
(
this
).
attr
(
'
id
'
).
replace
(
'
display-remove-link-
'
,
''
);
$
(
'
#display-row-
'
+
id
).
hide
();
$
(
'
#display-removed-
'
+
id
).
attr
(
'
checked
'
,
true
);
return
false
;
});
}
};
* jQuery UI tabs, Views integration component
*/
Drupal
.
behaviors
.
viewsTabs
=
{
attach
:
function
(
context
)
{
if
(
$
.
viewsUi
&&
$
.
viewsUi
.
tabs
)
{
$
(
'
#views-tabset
'
).
once
(
'
views-processed
'
).
viewsTabs
({
selectedClass
:
'
active
'
});
}
/**
* Helper function to parse a querystring.
*/
Drupal
.
Views
.
parseQueryString
=
function
(
query
)
{
var
args
=
{};
var
pos
=
query
.
indexOf
(
'
?
'
);
if
(
pos
!=
-
1
)
{
query
=
query
.
substring
(
pos
+
1
);
}
var
pairs
=
query
.
split
(
'
&
'
);
for
(
var
i
in
pairs
)
{
if
(
typeof
(
pairs
[
i
])
==
'
string
'
)
{
var
pair
=
pairs
[
i
].
split
(
'
=
'
);
// Ignore the 'q' path argument, if present.
if
(
pair
[
0
]
!=
'
q
'
&&
pair
[
1
])
{
args
[
decodeURIComponent
(
pair
[
0
].
replace
(
/
\+
/g
,
'
'
))]
=
decodeURIComponent
(
pair
[
1
].
replace
(
/
\+
/g
,
'
'
));
$
(
'
a.views-remove-link
'
).
once
(
'
views-processed
'
).
click
(
function
(
event
)
{
var
id
=
$
(
this
).
attr
(
'
id
'
).
replace
(
'
views-remove-link-
'
,
''
);
$
(
'
#views-row-
'
+
id
).
hide
();
$
(
'
#views-removed-
'
+
id
).
attr
(
'
checked
'
,
true
);
event
.
preventDefault
();
});
/**
* Here is to handle display deletion
* (checking in the hidden checkbox and hiding out the row)
*/
$
(
'
a.display-remove-link
'
)
.
addClass
(
'
display-processed
'
)
.
click
(
function
()
{
var
id
=
$
(
this
).
attr
(
'
id
'
).
replace
(
'
display-remove-link-
'
,
''
);
$
(
'
#display-row-
'
+
id
).
hide
();
$
(
'
#display-removed-
'
+
id
).
attr
(
'
checked
'
,
true
);
event
.
preventDefault
();
});
}
};
/**
* Helper function to parse a querystring.
*/
Drupal
.
Views
.
parseQueryString
=
function
(
query
)
{
var
args
=
{};
var
pos
=
query
.
indexOf
(
'
?
'
);
if
(
pos
!==
-
1
)
{
query
=
query
.
substring
(
pos
+
1
);
}
var
pairs
=
query
.
split
(
'
&
'
);
for
(
var
i
in
pairs
)
{
if
(
typeof
(
pairs
[
i
])
===
'
string
'
)
{
var
pair
=
pairs
[
i
].
split
(
'
=
'
);
// Ignore the 'q' path argument, if present.
if
(
pair
[
0
]
!==
'
q
'
&&
pair
[
1
])
{
args
[
decodeURIComponent
(
pair
[
0
].
replace
(
/
\+
/g
,
'
'
))]
=
decodeURIComponent
(
pair
[
1
].
replace
(
/
\+
/g
,
'
'
));
}
}
}
}
return
args
;
};
return
args
;
};
/**
* Helper function to return a view's arguments based on a path.
*/
Drupal
.
Views
.
parseViewArgs
=
function
(
href
,
viewPath
)
{
var
returnObj
=
{};
var
path
=
Drupal
.
Views
.
getPath
(
href
);
// Ensure we have a correct path.
if
(
viewPath
&&
path
.
substring
(
0
,
viewPath
.
length
+
1
)
==
viewPath
+
'
/
'
)
{
var
args
=
decodeURIComponent
(
path
.
substring
(
viewPath
.
length
+
1
,
path
.
length
));
returnObj
.
view_args
=
args
;
returnObj
.
view_path
=
path
;
}
return
returnObj
;
};
/**
* Helper function to return a view's arguments based on a path.
*/
Drupal
.
Views
.
parseViewArgs
=
function
(
href
,
viewPath
)
{
var
returnObj
=
{};
var
path
=
Drupal
.
Views
.
getPath
(
href
);
// Ensure we have a correct path.
if
(
viewPath
&&
path
.
substring
(
0
,
viewPath
.
length
+
1
)
=
==
viewPath
+
'
/
'
)
{
var
args
=
decodeURIComponent
(
path
.
substring
(
viewPath
.
length
+
1
,
path
.
length
));
returnObj
.
view_args
=
args
;
returnObj
.
view_path
=
path
;
}
return
returnObj
;
};
/**
* Strip off the protocol plus domain from an href.
*/
Drupal
.
Views
.
pathPortion
=
function
(
href
)
{
// Remove e.g. http://example.com if present.
var
protocol
=
window
.
location
.
protocol
;
if
(
href
.
substring
(
0
,
protocol
.
length
)
==
protocol
)
{
// 2 is the length of the '//' that normally follows the protocol
href
=
href
.
substring
(
href
.
indexOf
(
'
/
'
,
protocol
.
length
+
2
));
}
return
href
;
};
/**
* Strip off the protocol plus domain from an href.
*/
Drupal
.
Views
.
pathPortion
=
function
(
href
)
{
// Remove e.g. http://example.com if present.
var
protocol
=
window
.
location
.
protocol
;
if
(
href
.
substring
(
0
,
protocol
.
length
)
=
==
protocol
)
{
// 2 is the length of the '//' that normally follows the protocol
href
=
href
.
substring
(
href
.
indexOf
(
'
/
'
,
protocol
.
length
+
2
));
}
return
href
;
};
/**
* Return the Drupal path portion of an href.
*/
Drupal
.
Views
.
getPath
=
function
(
href
)
{
href
=
Drupal
.
Views
.
pathPortion
(
href
);
href
=
href
.
substring
(
Drupal
.
settings
.
basePath
.
length
,
href
.
length
);
// 3 is the length of the '?q=' added to the url without clean urls.
if
(
href
.
substring
(
0
,
3
)
==
'
?q=
'
)
{
href
=
href
.
substring
(
3
,
href
.
length
);
}
var
chars
=
[
'
#
'
,
'
?
'
,
'
&
'
];
for
(
i
in
chars
)
{
if
(
href
.
indexOf
(
chars
[
i
])
>
-
1
)
{
href
=
href
.
substr
(
0
,
href
.
indexOf
(
chars
[
i
]));
/**
* Return the Drupal path portion of an href.
*/
Drupal
.
Views
.
getPath
=
function
(
href
)
{
href
=
Drupal
.
Views
.
pathPortion
(
href
);
href
=
href
.
substring
(
Drupal
.
settings
.
basePath
.
length
,
href
.
length
);
// 3 is the length of the '?q=' added to the url without clean urls.
if
(
href
.
substring
(
0
,
3
)
===
'
?q=
'
)
{
href
=
href
.
substring
(
3
,
href
.
length
);
}
var
chars
=
[
'
#
'
,
'
?
'
,
'
&
'
];
for
(
i
in
chars
)
{
if
(
href
.
indexOf
(
chars
[
i
])
>
-
1
)
{
href
=
href
.
substr
(
0
,
href
.
indexOf
(
chars
[
i
]));
}
}
}
return
href
;
};
return
href
;
};
})(
jQuery
);
js/jquery.ui.dialog.patch.js
View file @
f24396f3
...
...
@@ -20,6 +20,9 @@
*/
(
function
(
$
,
undefined
)
{
"
use strict
"
;
if
(
$
.
ui
&&
$
.
ui
.
dialog
)
{
$
.
ui
.
dialog
.
overlay
.
events
=
$
.
map
(
'
focus,keydown,keypress
'
.
split
(
'
,
'
),
function
(
event
)
{
return
event
+
'
.dialog-overlay
'
;
}).
join
(
'
'
);
...
...
js/views-admin.js
View file @
f24396f3
...
...
@@ -10,6 +10,9 @@ Drupal.behaviors.viewsUiEditView = {};
* Improve the user experience of the views edit interface.
*/
Drupal
.
behaviors
.
viewsUiEditView
.
attach
=
function
(
context
,
settings
)
{
"
use strict
"
;
// Only show the SQL rewrite warning when the user has chosen the
// corresponding checkbox.
jQuery
(
'
#edit-query-options-disable-sql-rewrite
'
).
click
(
function
()
{
...
...
@@ -24,6 +27,9 @@ Drupal.behaviors.viewsUiAddView = {};
* page title and menu link.
*/
Drupal
.
behaviors
.
viewsUiAddView
.
attach
=
function
(
context
,
settings
)
{
"
use strict
"
;
var
$
=
jQuery
;
var
exclude
,
replace
,
suffix
;
// Set up regular expressions to allow only numbers, letters, and dashes.
...
...
@@ -89,6 +95,9 @@ Drupal.behaviors.viewsUiAddView.attach = function (context, settings) {
* Optional. A suffix to append at the end of the target field content.
*/
Drupal
.
viewsUi
.
FormFieldFiller
=
function
(
$target
,
exclude
,
replace
,
suffix
)
{
"
use strict
"
;
var
$
=
jQuery
;
this
.
source
=
$
(
'
#edit-human-name
'
);
this
.
target
=
$target
;
...
...
@@ -113,6 +122,9 @@ Drupal.viewsUi.FormFieldFiller = function ($target, exclude, replace, suffix) {
* Bind the form-filling behavior.
*/
Drupal
.
viewsUi
.
FormFieldFiller
.
prototype
.
bind
=
function
()
{
"
use strict
"
;
this
.
unbind
();
// Populate the form field when the source changes.
this
.
source
.
bind
(
'
keyup.viewsUi change.viewsUi
'
,
this
.
populate
);
...
...
@@ -124,6 +136,9 @@ Drupal.viewsUi.FormFieldFiller.prototype.bind = function () {
* Get the source form field value as altered by the passed-in parameters.
*/
Drupal
.
viewsUi
.
FormFieldFiller
.
prototype
.
getTransliterated
=
function
()
{
"
use strict
"
;
var
from
=
this
.
source
.
val
();
if
(
this
.
exclude
)
{
from
=
from
.
toLowerCase
().
replace
(
this
.
exclude
,
this
.
replace
);
...
...
@@ -135,6 +150,9 @@ Drupal.viewsUi.FormFieldFiller.prototype.getTransliterated = function () {
* Populate the target form field with the altered source field value.
*/
Drupal
.
viewsUi
.
FormFieldFiller
.
prototype
.
_populate
=
function
()
{
"
use strict
"
;
var
transliterated
=
this
.
getTransliterated
();
this
.
target
.
val
(
transliterated
);
};
...
...
@@ -143,6 +161,9 @@ Drupal.viewsUi.FormFieldFiller.prototype._populate = function () {
* Stop prepopulating the form fields.
*/
Drupal
.
viewsUi
.
FormFieldFiller
.
prototype
.
_unbind
=
function
()
{
"
use strict
"
;
this
.
source
.
unbind
(
'
keyup.viewsUi change.viewsUi
'
,
this
.
populate
);
this
.
target
.
unbind
(
'
focus.viewsUi
'
,
this
.
unbind
);
};
...
...
@@ -151,12 +172,18 @@ Drupal.viewsUi.FormFieldFiller.prototype._unbind = function () {
* Bind event handlers to the new form fields, after they're replaced via AJAX.
*/
Drupal
.
viewsUi
.
FormFieldFiller
.
prototype
.
rebind
=
function
(
$fields
)
{
"
use strict
"
;
this
.
target
=
$fields
;
this
.
bind
();
}
}
;
Drupal
.
behaviors
.
addItemForm
=
{};
Drupal
.
behaviors
.
addItemForm
.
attach
=
function
(
context
)
{
"
use strict
"
;
var
$
=
jQuery
;
// The add item form may have an id of views-ui-add-item-form--n.
var
$form
=
$
(
context
).
find
(
'
form[id^="views-ui-add-item-form"]
'
).
first
();
...
...
@@ -165,18 +192,24 @@ Drupal.behaviors.addItemForm.attach = function (context) {
if
(
$form
.
length
)
{
new
Drupal
.
viewsUi
.
addItemForm
(
$form
);
}
}
}
;
Drupal
.
viewsUi
.
addItemForm
=
function
(
$form
)
{
"
use strict
"
;
this
.
$form
=
$form
;
this
.
$form
.
find
(
'
.views-filterable-options :checkbox
'
).
click
(
jQuery
.
proxy
(
this
.
handleCheck
,
this
));
// Find the wrapper of the displayed text.
this
.
$selected_div
=
this
.
$form
.
find
(
'
.views-selected-options
'
).
parent
();
this
.
$selected_div
.
hide
();
this
.
checkedItems
=
[];
}
}
;
Drupal
.
viewsUi
.
addItemForm
.
prototype
.
handleCheck
=
function
(
event
)
{
"
use strict
"
;
var
$target
=
jQuery
(
event
.
target
);
var
label
=
jQuery
.
trim
(
$target
.
next
().
text
());
// Add/remove the checked item to the list.
...
...
@@ -189,29 +222,32 @@ Drupal.viewsUi.addItemForm.prototype.handleCheck = function (event) {
var
position
=
jQuery
.
inArray
(
label
,
this
.
checkedItems
);
// Delete the item from the list and take sure that the list doesn't have undefined items left.
for
(
var
i
=
0
;
i
<
this
.
checkedItems
.
length
;
i
++
)
{
if
(
i
==
position
)
{
if
(
i
==
=
position
)
{
this
.
checkedItems
.
splice
(
i
,
1
);
i
--
;
break
;
}
}
// Hide it again if none item is selected.
if
(
this
.
checkedItems
.
length
==
0
)
{
if
(
this
.
checkedItems
.
length
==
=
0
)
{
this
.
$selected_div
.
hide
();
}
}
this
.
refreshCheckedItems
();
}
}
;
/**
* Refresh the display of the checked items.
*/
Drupal
.
viewsUi
.
addItemForm
.
prototype
.
refreshCheckedItems
=
function
()
{
"
use strict
"
;
// Perhaps we should precache the text div, too.
this
.
$selected_div
.
find
(
'
.views-selected-options
'
).
html
(
this
.
checkedItems
.
join
(
'
,
'
));
Drupal
.
viewsUi
.
resizeModal
(
''
,
true
);
}
}
;
/**
...
...
@@ -222,6 +258,9 @@ Drupal.viewsUi.addItemForm.prototype.refreshCheckedItems = function() {
Drupal
.
behaviors
.
viewsUiRenderAddViewButton
=
{};
Drupal
.
behaviors
.
viewsUiRenderAddViewButton
.
attach
=
function
(
context
,
settings
)
{
"
use strict
"
;
var
$
=
jQuery
;
// Build the add display menu and pull the display input buttons into it.
var
$menu
=
$
(
'
#views-display-menu-tabs
'
,
context
).
once
(
'
views-ui-render-add-view-button-processed
'
);
...
...
@@ -239,7 +278,7 @@ Drupal.behaviors.viewsUiRenderAddViewButton.attach = function (context, settings
// support for translation.
$displayButtons
.
each
(
function
()
{
var
label
=
$
(
this
).
val
();
if
(
label
.
substr
(
0
,
4
)
==
'
Add
'
)
{
if
(
label
.
substr
(
0
,
4
)
==
=
'
Add
'
)
{
$
(
this
).
val
(
label
.
substr
(
4
));
}
});
...
...
@@ -272,14 +311,20 @@ Drupal.behaviors.viewsUiRenderAddViewButton.attach = function (context, settings
* not written specifically for this UI, but I'm not sure where to put it.
*/
Drupal
.
behaviors
.
viewsUiRenderAddViewButton
.
toggleMenu
=
function
(
$trigger
)
{
"
use strict
"
;
$trigger
.
parent
().
toggleClass
(
'
open
'
);
$trigger
.
next
().
slideToggle
(
'
fast
'
);
}
}
;
Drupal
.
behaviors
.
viewsUiSearchOptions
=
{};
Drupal
.
behaviors
.
viewsUiSearchOptions
.
attach
=
function
(
context
)
{
"
use strict
"
;
var
$
=
jQuery
;
// The add item form may have an id of views-ui-add-item-form--n.
var
$form
=
$
(
context
).
find
(
'
form[id^="views-ui-add-item-form"]
'
).
first
();
...
...
@@ -298,6 +343,9 @@ Drupal.behaviors.viewsUiSearchOptions.attach = function (context) {
* containing "taxonomy" in their label.
*/
Drupal
.
viewsUi
.
OptionsSearch
=
function
(
$form
)
{
"
use strict
"
;
this
.
$form
=
$form
;
// Add a keyup handler to the search box.
this
.
$searchBox
=
this
.
$form
.
find
(
'
#edit-options-search
'
);
...
...
@@ -309,7 +357,7 @@ Drupal.viewsUi.OptionsSearch = function ($form) {
this
.
handleKeyup
();
// Trap the ENTER key in the search box so that it doesn't submit the form.
this
.
$searchBox
.
keypress
(
function
(
event
)
{
if
(
event
.
which
==
13
)
{
if
(
event
.
which
==
=
13
)
{
event
.
preventDefault
();
}
});
...
...
@@ -323,6 +371,9 @@ Drupal.viewsUi.OptionsSearch = function ($form) {
* shown and hidden depending on the user's search terms.
*/
Drupal
.
viewsUi
.
OptionsSearch
.
prototype
.
getOptions
=
function
(
$allOptions
)
{
"
use strict
"
;
var
$
=
jQuery
;
var
i
,
$label
,
$description
,
$option
;
var
options
=
[];
...
...
@@ -338,7 +389,7 @@ Drupal.viewsUi.OptionsSearch.prototype.getOptions = function ($allOptions) {
// have to create a new object inside the performance-sensitive keyup
// handler.
'
$div
'
:
$option
}
}
;
}
return
options
;
};
...
...
@@ -347,6 +398,9 @@ Drupal.viewsUi.OptionsSearch.prototype.getOptions = function ($allOptions) {
* Keyup handler for the search box that hides or shows the relevant options.
*/
Drupal
.
viewsUi
.
OptionsSearch
.
prototype
.
handleKeyup
=
function
(
event
)
{
"
use strict
"
;
var
found
,
i
,
j
,
option
,
search
,
words
,
wordsLength
,
zebraClass
,
zebraCounter
;
// Determine the user's search query. The search text has been converted to
...
...
@@ -389,11 +443,14 @@ Drupal.viewsUi.OptionsSearch.prototype.handleKeyup = function (event) {
Drupal
.
behaviors
.
viewsUiPreview
=
{};
Drupal
.
behaviors
.
viewsUiPreview
.
attach
=
function
(
context
,
settings
)
{
"
use strict
"
;
var
$
=
jQuery
;
// Only act on the edit view form.
var
contextualFiltersBucket
=
$
(
'
.views-display-column .views-ui-display-tab-bucket.contextual-filters
'
,
context
);
if
(
contextualFiltersBucket
.
length
==
0
)
{
if
(
contextualFiltersBucket
.
length
==
=
0
)
{
return
;
}
...
...
@@ -417,9 +474,12 @@ Drupal.behaviors.viewsUiPreview.attach = function (context, settings) {
Drupal
.
behaviors
.
viewsUiRearrangeFilter
=
{};
Drupal
.
behaviors
.
viewsUiRearrangeFilter
.
attach
=
function
(
context
,
settings
)
{
"
use strict
"
;
var
$
=
jQuery
;
// Only act on the rearrange filter form.
if
(
typeof
Drupal
.
tableDrag
==
'
undefined
'
||
typeof
Drupal
.
tableDrag
[
'
views-rearrange-filters
'
]
==
'
undefined
'
)
{
if
(
typeof
Drupal
.
tableDrag
==
=
'
undefined
'
||
typeof
Drupal
.
tableDrag
[
'
views-rearrange-filters
'
]
=
==
'
undefined
'
)
{
return
;
}
...
...
@@ -434,6 +494,9 @@ Drupal.behaviors.viewsUiRearrangeFilter.attach = function (context, settings) {
* Improve the UI of the rearrange filters dialog box.
*/
Drupal
.
viewsUi
.
rearrangeFilterHandler
=
function
(
table
,
operator
)
{
"
use strict
"
;
var
$
=
jQuery
;
// Keep a reference to the <table> being altered and to the div containing
// the filter groups operator dropdown (if it exists).
...
...
@@ -489,6 +552,9 @@ Drupal.viewsUi.rearrangeFilterHandler = function (table, operator) {
* Insert links that allow filter groups to be added and removed.
*/
Drupal
.
viewsUi
.
rearrangeFilterHandler
.
prototype
.
insertAddRemoveFilterGroupLinks
=
function
()
{
"
use strict
"
;
var
$
=
jQuery
;
// Insert a link for adding a new group at the top of the page, and make it
...
...
@@ -521,12 +587,15 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.insertAddRemoveFilterGroupLinks
* Dynamically click the button that adds a new filter group.
*/
Drupal
.
viewsUi
.
rearrangeFilterHandler
.
prototype
.
clickAddGroupButton
=
function
()
{
"
use strict
"
;
// Due to conflicts between Drupal core's AJAX system and the Views AJAX
// system, the only way to get this to work seems to be to trigger both the
// .mousedown() and .submit() events.
this
.
addGroupButton
.
mousedown
();
this
.
addGroupButton
.
submit
();
return
false
;
event
.
preventDefault
()
;
};
/**
...
...
@@ -537,11 +606,14 @@ Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton = function (
* form button that should be clicked.
*/
Drupal
.
viewsUi
.
rearrangeFilterHandler
.
prototype
.
clickRemoveGroupButton
=
function
(
event
)
{
"
use strict
"
;
// For some reason, here we only need to trigger .submit(), unlike for
// Drupal.viewsUi.rearrangeFilterHandler.prototype.clickAddGroupButton()
// where we had to trigger .mousedown() also.
jQuery
(
'
input#
'
+
event
.
data
.
buttonId
,
this
.
table
).
submit
();
return
false
;
event
.
preventDefault
()
;