mirror of
https://github.com/e107inc/e107.git
synced 2025-04-21 05:02:02 +02:00
Media-Manager Youtube browser added.
This commit is contained in:
parent
7f9326f1a1
commit
3688924e42
@ -458,7 +458,7 @@ class page_admin_ui extends e_admin_ui
|
||||
'menu_template' => array('title'=> "Menu Template", 'nolist'=>true, 'tab' => 2, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
|
||||
'menu_icon' => array('title' =>"Menu Icon/Glyph", 'nolist'=>true, 'tab' => 2, 'type' => 'icon', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&glyphs=1', 'readonly'=>false),
|
||||
|
||||
'menu_image' => array('title' =>"Menu Image", 'nolist'=>true, 'tab' => 2, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page', 'readonly'=>false),
|
||||
'menu_image' => array('title' =>"Menu Image/Video", 'nolist'=>true, 'tab' => 2, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&video=1', 'readonly'=>false),
|
||||
|
||||
|
||||
|
||||
@ -494,7 +494,7 @@ class page_admin_ui extends e_admin_ui
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'page_id' => array('title'=> 'ID', 'type'=>'text', 'tab' => 0, 'width'=>'5%', 'readParms'=>'','forced'=> TRUE),
|
||||
|
||||
'menu_image' => array('title' =>"Menu Image", 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=80&thumb_urlraw=0&thumb_aw=80', 'readonly'=>false),
|
||||
'menu_image' => array('title' =>"Menu Image/Video", 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=140&thumb_urlraw=0&thumb_aw=140', 'readonly'=>false),
|
||||
|
||||
'menu_name' => array('title'=> "Menu Name", 'type' => 'text', 'inline'=>true, 'width' => 'auto','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name"),
|
||||
'menu_template' => array('title'=> "Menu Template", 'type' => 'dropdown', 'width' => 'auto', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
|
||||
|
@ -45,6 +45,14 @@ if(isset($_POST['submit_cancel_show']))
|
||||
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
||||
|
||||
|
||||
if(vartrue($_GET['action']) == 'youtube' && e_AJAX_REQUEST) //XXX Doesn't work correctly inside the class for some reason
|
||||
{
|
||||
//echo "it works";
|
||||
//exit;
|
||||
|
||||
}
|
||||
|
||||
if(vartrue($_GET['action']) == 'nav' && e_AJAX_REQUEST) //XXX Doesn't work correctly inside the class for some reason
|
||||
{
|
||||
define("e_IFRAME",true);
|
||||
@ -835,6 +843,14 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
// print_a($_GET);
|
||||
|
||||
if($this->getAction() == 'youtube')
|
||||
{
|
||||
$parm = array('search'=>$_GET['search']);
|
||||
echo $this->videotab($parm);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if($_GET['action'] == 'nav' )
|
||||
{
|
||||
//echo $this->navPage();\
|
||||
@ -1027,6 +1043,12 @@ class media_admin_ui extends e_admin_ui
|
||||
$text .= "<li><a data-toggle='tab' href='#core-media-glyphs'>Glyphs</a></li>\n";
|
||||
}
|
||||
|
||||
if($this->getQuery('video') == 1)
|
||||
{
|
||||
$text .= "<li><a data-toggle='tab' href='#core-media-video'>Youtube</a></li>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(varset($options['bbcode']))
|
||||
{
|
||||
@ -1169,6 +1191,20 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
}
|
||||
|
||||
if($this->getQuery('video'))
|
||||
{
|
||||
$text .= "<div class='tab-pane clearfix' id='core-media-video' >";
|
||||
$text .= "<div style='padding:20px'>";
|
||||
$text .= $this->videoTab();
|
||||
$text .= "</div>";
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$text .= "</div>";
|
||||
|
||||
// For BBCODE mode. //TODO image-float.
|
||||
@ -1204,7 +1240,52 @@ class media_admin_ui extends e_admin_ui
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
function videoTab($parm='')
|
||||
{
|
||||
|
||||
// $feed = "https://gdata.youtube.com/feeds/base/users/e107inc/uploads";
|
||||
|
||||
if($search = vartrue($this->getQuery('search')))
|
||||
{
|
||||
$feed = "http://gdata.youtube.com/feeds/api/videos?orderby=relevance&vq=".urlencode($search)."&max-results=50"; // maximum is 50.
|
||||
}
|
||||
else
|
||||
{
|
||||
$feed = "https://gdata.youtube.com/feeds/api/users/e107inc/uploads";
|
||||
}
|
||||
|
||||
$data = e107::getXml()->loadXMLfile($feed,true);
|
||||
|
||||
// $text .= "<h2>".$data['title']."</h2>";
|
||||
// $text .= print_a($data,true);
|
||||
|
||||
$items = array();
|
||||
|
||||
foreach($data['entry'] as $value)
|
||||
{
|
||||
$id = str_replace('http://gdata.youtube.com/feeds/api/videos/','',$value['id']); // http://gdata.youtube.com/feeds/api/videos/_j0b9syAuIk
|
||||
$thumbnail = "https://i1.ytimg.com/vi/".$id."/0.jpg";
|
||||
|
||||
$items[] = array(
|
||||
'previewUrl' => $thumbnail,
|
||||
'saveValue' => $id.".youtube",
|
||||
'thumbUrl' => $thumbnail,
|
||||
'title' => $value['title']
|
||||
);
|
||||
}
|
||||
|
||||
$parms = array('width' => 200, 'height'=>113, 'type'=>'image', 'tagid'=> $this->getQuery('tagid'), 'action'=>'youtube');
|
||||
|
||||
|
||||
$text = e107::getMedia()->browserCarousel($items, $parms);
|
||||
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function importPage()
|
||||
@ -1212,6 +1293,10 @@ class media_admin_ui extends e_admin_ui
|
||||
$this->processUploadUrl();
|
||||
$this->batchImportForm();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function processUploadUrl($import = false, $cat='_common')
|
||||
{
|
||||
|
@ -210,8 +210,14 @@ class cpage_shortcodes extends e_shortcode
|
||||
|
||||
function sc_cmenuimage($parm='')
|
||||
{
|
||||
// print_a($this);
|
||||
$img = e107::getParser()->thumbUrl($this->page['menu_image']);
|
||||
$tp = e107::getParser();
|
||||
|
||||
if($video = $tp->toVideo($this->page['menu_image']))
|
||||
{
|
||||
return $video;
|
||||
}
|
||||
|
||||
$img = $tp->thumbUrl($this->page['menu_image']);
|
||||
if($parm == 'url')
|
||||
{
|
||||
return $img;
|
||||
|
@ -2756,6 +2756,46 @@ class e_parser
|
||||
return "<img class='icon' src='".$path."' alt='".basename($path)."' />";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file - format: id.type eg. x123dkax.youtube
|
||||
* @param boolean $thumbnail - set to 'tag' to return an image thumbnail and 'src' to return the src url or 'video' for a small video thumbnail.
|
||||
*/
|
||||
function toVideo($file, $parm=array())
|
||||
{
|
||||
list($id,$type) = explode(".",$file,2);
|
||||
|
||||
$thumb = vartrue($parm['thumb']);
|
||||
|
||||
if($type == 'youtube')
|
||||
{
|
||||
$video = '<iframe width="560" height="315" src="//www.youtube.com/embed/'.$id.'" frameborder="0" allowfullscreen></iframe>';
|
||||
$thumbSrc = "https://i1.ytimg.com/vi/".$id."/0.jpg";
|
||||
|
||||
if($thumb == 'tag')
|
||||
{
|
||||
return "<img class='img-responsive' src='".$thumbSrc."' alt='' style='max-width:".vartrue($parm['w'],'80')."px'/>";
|
||||
}
|
||||
|
||||
if($thumb == 'src')
|
||||
{
|
||||
return $thumbSrc;
|
||||
}
|
||||
|
||||
if($thumb == 'video')
|
||||
{
|
||||
return '<div class="video-responsive video-thumbnail thumbnail">'.$video.'</div>';
|
||||
}
|
||||
|
||||
return '<div class="video-responsive">'.$video.'</div>';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Parse new <bbcode> tags into bbcode output.
|
||||
|
@ -335,7 +335,12 @@ class e_form
|
||||
if(vartrue($extras['glyphs']))
|
||||
{
|
||||
$url .= "&glyphs=1";
|
||||
}
|
||||
}
|
||||
|
||||
if(vartrue($extras['video']))
|
||||
{
|
||||
$url .= "&video=1";
|
||||
}
|
||||
|
||||
$title = "Media Manager : ".$category;
|
||||
|
||||
@ -498,6 +503,7 @@ class e_form
|
||||
parse_str($sc_parameters, $sc_parameters);
|
||||
}
|
||||
|
||||
// print_a($sc_parameters);
|
||||
|
||||
$default_thumb = $default;
|
||||
if($default)
|
||||
@ -510,6 +516,11 @@ class e_form
|
||||
}
|
||||
$default_url = $tp->replaceConstants($default, 'abs');
|
||||
$blank = FALSE;
|
||||
|
||||
if($video = $tp->toVideo($default_url, array('thumb'=>'src')))
|
||||
{
|
||||
$default_url = $video;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -552,6 +563,8 @@ class e_form
|
||||
$ret = "<div class='imgselector-container e-tip' {$title} style='display:block;width:".$width."px;min-height:".$height."px;'>";
|
||||
$att = 'aw='.$width."'&ah=".$height."'";
|
||||
$thpath = isset($sc_parameters['nothumb']) || vartrue($hide) ? $default : $tp->thumbUrl($default_thumb, $att, true);
|
||||
|
||||
|
||||
$label = "<img id='{$name_id}_prev' src='{$default_url}' alt='{$default_url}' class='well well-small image-selector' style='display:block;' />";
|
||||
|
||||
if($cat != 'news' && $cat !='page' && $cat !='')
|
||||
@ -2687,7 +2700,13 @@ class e_form
|
||||
case 'image': //TODO - thumb, js tooltip...
|
||||
if($value)
|
||||
{
|
||||
|
||||
$vparm = array('thumb'=>'tag','w'=> vartrue($parms['thumb_aw'],'80'));
|
||||
|
||||
if($video = e107::getParser()->toVideo($value,$vparm))
|
||||
{
|
||||
return $video;
|
||||
}
|
||||
|
||||
if(!preg_match("/[a-zA-z0-9_-\s\(\)]+\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF)$/",$value))
|
||||
{
|
||||
$icon = "{e_IMAGE}filemanager/zip_32.png";
|
||||
|
@ -528,8 +528,10 @@ class e_media
|
||||
$cat .= varset($option['limit']) ? "&limit=".$option['limit'] : "";
|
||||
$cat .= varset($option['frm']) ? "&frm=".$option['frm'] : "";
|
||||
$cat .= varset($option['w']) ? "&w=".$option['w'] : "";
|
||||
|
||||
$action = varset($option['action'],'nav');
|
||||
|
||||
$url = e_ADMIN_ABS."image.php?mode=main&action=nav&iframe=1".$cat."&from=0";
|
||||
$url = e_ADMIN_ABS."image.php?mode=main&action=".$action."&iframe=1".$cat."&from=0";
|
||||
|
||||
return $url;
|
||||
}
|
||||
@ -930,6 +932,164 @@ class e_media
|
||||
}
|
||||
|
||||
|
||||
function browserCarouselItem($row = array())
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$defaultThumb = $tp->thumbUrl('','w=400&h=240');
|
||||
|
||||
$default = array(
|
||||
'width' => 200,
|
||||
'height' => 113,
|
||||
'id' => '',
|
||||
'type' => 'image',
|
||||
'tagid' => '',
|
||||
'saveValue' => '',
|
||||
'previewUrl' => $defaultThumb ,
|
||||
'thumbUrl' => $defaultThumb,
|
||||
'title' => ''
|
||||
|
||||
);
|
||||
|
||||
$data = array();
|
||||
|
||||
foreach($default as $k=>$v)
|
||||
{
|
||||
$data[$k] = isset($row[$k]) ? $row[$k] : $default[$k];
|
||||
}
|
||||
|
||||
|
||||
$close = (E107_DEBUG_LEVEL > 0) ? "" : "e-dialog-close";
|
||||
|
||||
|
||||
$text .= "<div class='browserItem span2'>";
|
||||
$text .= '<div class="well clearfix">';
|
||||
$text .= "<a data-toggle='context' class='e-media-select ".$close." e-tip' data-id='".$data['id']."' data-width='".$data['width']."' data-height='".$data['height']."' data-src='".$data['previewUrl']."' data-type='".$data['type']."' data-bbcode='{$bbcode}' data-target='".$data['tagid']."' data-path='".$data['saveValue']."' data-preview='".$data['previewUrl']."' title=\"".$data['title']."\" style='float:left' href='#' >";
|
||||
// $text .= "<span style='margin:7px;display:inline-block'></span>";
|
||||
$text .= '<img class="img-responsive" alt="" src="'.$data['thumbUrl'].'" style="width:100%;display:inline-block" />';
|
||||
$text .= "</a>\n\n";
|
||||
$text .= "<div><small style='padding-top:8px;white-space:nowrap;display:inline-block;width:100%;overflow:hidden'>".$data['title']."</small></div>";
|
||||
$text .= "</div>";
|
||||
$text .= "</div>";
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
function browserIndicators($slides=array())
|
||||
{
|
||||
|
||||
if(count($slides)<1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$indicators = '<ol class="carousel-indicators span2" style="top:-40px">
|
||||
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>';
|
||||
|
||||
foreach($slides as $key=>$v)
|
||||
{
|
||||
$id = $key + 1;
|
||||
$indicators .= '<li data-target="#myCarousel" data-slide-to="'.$id.'"></li>';
|
||||
}
|
||||
|
||||
$indicators .= '</ol>';
|
||||
|
||||
return $indicators;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function browserCarousel($data,$parm=null)
|
||||
{
|
||||
/* Fix for Bootstrap2 margin-left issue when wrapping */
|
||||
e107::css('inline','
|
||||
|
||||
.browserItem { margin-bottom:15px }
|
||||
|
||||
.row-fluid .browserItem.span6:nth-child(2n + 3) { margin-left : 0px; }
|
||||
.row-fluid .browserItem.span4:nth-child(3n + 4) { margin-left : 0px; }
|
||||
.row-fluid .browserItem.span3:nth-child(4n + 5) { margin-left : 0px; }
|
||||
.row-fluid .browserItem.span2:nth-child(6n + 7) { margin-left : 0px; }
|
||||
');
|
||||
|
||||
$frm = varset($option['from']) ? $option['from'] : 0;
|
||||
$limit = varset($option['limit']) ? $option['limit'] : 20;
|
||||
$bbcode = varset($option['bbcode']) ? $option['bbcode'] : null;
|
||||
$navMode = varset($option['nav']) ? TRUE : FALSE;
|
||||
$search = varset($option['search']) ? $option['search'] : null;
|
||||
|
||||
$frm = e107::getForm();
|
||||
|
||||
// $text .= print_a($_GET,true);
|
||||
|
||||
$data_src = $this->mediaSelectNav($category,$parm['tagid'], $parm);
|
||||
|
||||
//$text = "<form class='form-search' action='".e_SELF."?".e_QUERY."' id='core-plugin-list-form' method='get'>";
|
||||
|
||||
if(!e_AJAX_REQUEST)
|
||||
{
|
||||
$text = '<div class="btn-group"><span class="input-append">';
|
||||
$text .= "<input type='text'class='e-ajax-keyup e-tip' placeholder= 'Search...' title='Enter some text to filter results' name='search' value='' data-target='media-browser-container' data-src='".$data_src."' />";
|
||||
// $text .= '<button class="btn btn-primary" name="'.$submitName.'" type="submit">'.LAN_GO.'</button>';
|
||||
$text .= '<a class="btn btn-primary" href="#myCarousel" data-slide="prev">‹</a><a class="btn btn-primary" href="#myCarousel" data-slide="next">›</a>';
|
||||
$text .= "</span>";
|
||||
$text .= "</div>";
|
||||
$text .= "<div id='media-browser-container' class='form-inline clearfix row-fluid'>";
|
||||
}
|
||||
|
||||
// $text .= $this->search('srch', $srch, 'go', $filterName, $filterArray, $filterVal).$frm->hidden('mode','online');
|
||||
|
||||
|
||||
$text .= '<div id="myCarousel" class="carousel slide" data-interval="false">';
|
||||
$text .= '{INDICATORS}';
|
||||
$text .= '<div id="shop" style="margin-top:10px;min-height:585px" class="carousel-inner">';
|
||||
|
||||
|
||||
$text .= "<div class='item active row-fluid'>";
|
||||
|
||||
$perPage = vartrue($parm['perPage'],12);
|
||||
|
||||
$c=0;
|
||||
|
||||
$slides = array();
|
||||
|
||||
|
||||
foreach($data as $key=>$val)
|
||||
{
|
||||
$val['width'] = $parm['width'];
|
||||
$val['height'] = $parm['height'];
|
||||
$val['id'] = $parm['id'];
|
||||
$val['tagid'] = $parm['tagid'];
|
||||
$val['type'] = $parm['type'];
|
||||
|
||||
|
||||
$text .= $this->browserCarouselItem($val);
|
||||
|
||||
$c++;
|
||||
|
||||
if($c == $perPage)
|
||||
{
|
||||
$text .= '</div><div class="item">';
|
||||
$slides[] = 1;
|
||||
$c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "</div><div class='clearfix'> </div>\n\n";
|
||||
|
||||
$text .= "</div>";
|
||||
|
||||
if(!e_AJAX_REQUEST)
|
||||
{
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
$ret = str_replace('{INDICATORS}', $this->browserIndicators($slides), $text);
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -907,6 +907,27 @@ li.rssRow > div {
|
||||
position: static;
|
||||
}
|
||||
|
||||
.video-responsive {
|
||||
position: relative;
|
||||
padding-bottom: 56.25%;
|
||||
padding-top: 30px; height: 0; overflow: hidden;
|
||||
}
|
||||
|
||||
.video-responsive iframe,
|
||||
.video-responsive object,
|
||||
.video-responsive embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
.video-thumbnail iframe {
|
||||
width:142px;
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
body { background-color: rgb(68, 68, 68); }
|
||||
|
@ -219,6 +219,20 @@ div.e-comment-edit-save { margin-top:8px; padding: 5px }
|
||||
span.e-hide-if-js,
|
||||
button.e-hide-if-js { display: inline; }
|
||||
*/
|
||||
|
||||
.video-responsive {
|
||||
position: relative;
|
||||
padding-bottom: 56.25%;
|
||||
padding-top: 30px; height: 0; overflow: hidden;
|
||||
}
|
||||
|
||||
.video-responsive iframe,
|
||||
.video-responsive object,
|
||||
.video-responsive embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ a.media-select-icon { text-align:center; vertical-align:middle; margin:1px; bo
|
||||
a.media-select-icon:hover { border:1px solid red; }
|
||||
.media-select-container { padding:10px; }
|
||||
|
||||
.media-select-active { border: 1px solid silver; }
|
||||
.media-select-active { opacity: .5; }
|
||||
|
||||
.e-moving { background-color: silver; }
|
||||
|
||||
|
@ -61,22 +61,22 @@ $(document).ready(function()
|
||||
var _float = $('#float').val();
|
||||
|
||||
|
||||
if(margin_right !='')
|
||||
if(margin_right !='' && margin_right !== undefined)
|
||||
{
|
||||
style = style + 'margin-right:' + margin_right + 'px;';
|
||||
}
|
||||
|
||||
if(margin_left !='')
|
||||
if(margin_left !='' && margin_left !== undefined)
|
||||
{
|
||||
style = style + 'margin-left:' + margin_left + 'px;';
|
||||
}
|
||||
|
||||
if(margin_top !='')
|
||||
if(margin_top !='' && margin_top !== undefined)
|
||||
{
|
||||
style = style + 'margin-top:' + margin_top + 'px;';
|
||||
}
|
||||
|
||||
if(margin_bottom !='')
|
||||
if(margin_bottom !='' && margin_bottom !== undefined)
|
||||
{
|
||||
style = style + 'margin-bottom:' + margin_bottom + 'px;';
|
||||
}
|
||||
@ -86,7 +86,15 @@ $(document).ready(function()
|
||||
style = style + 'float:' + _float + ';';
|
||||
}
|
||||
|
||||
if(width === undefined)
|
||||
{
|
||||
width = '';
|
||||
}
|
||||
|
||||
if(height === undefined)
|
||||
{
|
||||
height = '';
|
||||
}
|
||||
|
||||
// Set the Html / Wysiwyg Value.
|
||||
var html = '<img class="img-rounded" style=\"' + style + '\" src=\"'+ src +'\" alt=\"\" width=\"' + width + '\" height=\"' + height + '\" />';
|
||||
@ -94,12 +102,12 @@ $(document).ready(function()
|
||||
|
||||
|
||||
// Only Do width/height styling on bbcodes --
|
||||
if(width !='')
|
||||
if(width !='' && width !== undefined)
|
||||
{
|
||||
style = style + 'width:' + width + 'px;';
|
||||
}
|
||||
|
||||
if(height !='')
|
||||
if(height !='' && height !== undefined)
|
||||
{
|
||||
style = style + 'height:' + height + 'px;';
|
||||
}
|
||||
@ -279,6 +287,49 @@ $(document).ready(function()
|
||||
mediaNav(this,null);
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Ajax keyup search. Used by media-browser.
|
||||
|
||||
var delay = (function(){
|
||||
var timer = 0;
|
||||
return function(callback, ms){
|
||||
clearTimeout (timer);
|
||||
timer = setTimeout(callback, ms);
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
$(".e-ajax-keyup").keyup(function(){
|
||||
|
||||
var id = $(this).attr("data-target");
|
||||
var src = $(this).attr("data-src");
|
||||
var search = $(this).val();
|
||||
|
||||
if(search !== null)
|
||||
{
|
||||
src = src + '&search=' + encodeURIComponent(search);
|
||||
}
|
||||
|
||||
// alert(src);
|
||||
|
||||
$('#'+id).fadeOut('fast');
|
||||
|
||||
delay(function(){
|
||||
|
||||
if((search.length) >= 3) {
|
||||
$('#'+id).load(src,function() {
|
||||
// alert(src);
|
||||
|
||||
$('#'+id).fadeIn('fast'); // .slideLeft();
|
||||
});
|
||||
}
|
||||
|
||||
}, 300 );
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function mediaNav(e,navid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user