Я использую плагин «wp-video-lightbox» для wordpress, который создает небольшие плавающие боксы для моих видео.Выполнение скрипта из плагина wordpress
Я хотел бы использовать переменные, такие как http://www.example.com/?video3
, чтобы предлагать ярлыки, такие как youtube, поэтому я попытался найти способ выполнить скрипт на загрузке страницы (в зависимости от переменной).
Это функция из сценария:
/* ------------------------------------------------------------------------
Class: prettyPhoto
Use: Lightbox clone for jQuery
Author: Stephane Caron (http://www.no-margin-for-errors.com)
Version: 3.1.5
------------------------------------------------------------------------- */
(function($) {
$.prettyPhoto = {version: '3.1.5'};
$.fn.prettyPhoto = function(pp_settings) {
...
$.prettyPhoto.initialize = function() {
settings = pp_settings;
if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
// Find out if the picture is part of a set
theRel = $(this).attr(settings.hook);
galleryRegExp = /\[(?:.*)\]/;
isSet = (galleryRegExp.exec(theRel)) ? true : false;
// Put the SRCs, TITLEs, ALTs into an array.
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('rev')) ? $(n).attr('rev') : ""; }) : $.makeArray($(this).attr('rev'));
if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
_build_overlay(this); // Build the overlay {this} being the caller
if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
$.prettyPhoto.open();
return false;
}
...
};
}) (Jquery);
Когда я использую <body onload="jQuery.prettyPhoto.initialize">
, кажется, функция возвращается как строка (?). Я пробовал eval(jQuery.prettyPhoto.initialize)
и F=new Function(jQuery.prettyPhoto.initialize);return(F());
без преуспевания.
У кого-нибудь есть идея?
Вам нужно включить '()'? как в:
–