Commit 2141b701 authored by frjo's avatar frjo
Browse files

Issue #1096428: Add protection from missing plugin in Colorbox module scripts....

Issue #1096428: Add protection from missing plugin in Colorbox module scripts. Suggestion and code example from merlinofchaos.
parent 41d33d09
......@@ -2,6 +2,9 @@
Drupal.behaviors.initColorbox = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox)) {
return;
}
$('a, area, input', context)
.filter('.colorbox')
.once('init-colorbox-processed')
......
......@@ -2,6 +2,9 @@
Drupal.behaviors.initColorboxInline = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox)) {
return;
}
$.urlParam = function(name, url){
if (name == 'fragment') {
var results = new RegExp('(#[^&#]*)').exec(url);
......
......@@ -2,6 +2,9 @@
Drupal.behaviors.initColorboxLoad = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox)) {
return;
}
$.urlParam = function(name, url){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
if (!results) { return ''; }
......
......@@ -2,6 +2,9 @@
Drupal.behaviors.initColorboxLogin = {
attach: function (context, settings) {
if (!$.isFunction($.colorbox)) {
return;
}
$("a[href*='/user/login'], a[href*='?q=user/login']", context).once('init-colorbox-login-processed', function () {
this.href = this.href.replace(/user\/login/,"user/login/colorbox");
}).colorbox({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment