added custom video overlay player to avoid to load all the iframe systematicly
This commit is contained in:
@@ -289,15 +289,14 @@ function clameurs_field_default_field_instances() {
|
||||
'display' => array(
|
||||
'accueil' => array(
|
||||
'label' => 'hidden',
|
||||
'module' => 'video_embed_field_overlay',
|
||||
'module' => 'video_embed_field',
|
||||
'settings' => array(
|
||||
'description' => 1,
|
||||
'description_position' => 'bottom',
|
||||
'image_link' => 'source',
|
||||
'image_style' => 'video_thumb_docu',
|
||||
'overlay' => 'dom-window',
|
||||
'show_thumbnail' => 1,
|
||||
'video_style' => 'normal',
|
||||
),
|
||||
'type' => 'video_embed_field_overlay',
|
||||
'type' => 'video_embed_field_thumbnail',
|
||||
'weight' => 5,
|
||||
),
|
||||
'default' => array(
|
||||
@@ -457,15 +456,14 @@ function clameurs_field_default_field_instances() {
|
||||
'display' => array(
|
||||
'accueil' => array(
|
||||
'label' => 'hidden',
|
||||
'module' => 'video_embed_field_overlay',
|
||||
'module' => 'video_embed_field',
|
||||
'settings' => array(
|
||||
'description' => 1,
|
||||
'description_position' => 'bottom',
|
||||
'image_link' => 'source',
|
||||
'image_style' => 'video_thumb_episode',
|
||||
'overlay' => 'dom-window',
|
||||
'show_thumbnail' => 1,
|
||||
'video_style' => 'normal',
|
||||
),
|
||||
'type' => 'video_embed_field_overlay',
|
||||
'type' => 'video_embed_field_thumbnail',
|
||||
'weight' => 9,
|
||||
),
|
||||
'default' => array(
|
||||
@@ -893,15 +891,14 @@ function clameurs_field_default_field_instances() {
|
||||
'display' => array(
|
||||
'accueil' => array(
|
||||
'label' => 'hidden',
|
||||
'module' => 'video_embed_field_overlay',
|
||||
'module' => 'video_embed_field',
|
||||
'settings' => array(
|
||||
'description' => 1,
|
||||
'description_position' => 'bottom',
|
||||
'image_link' => 'source',
|
||||
'image_style' => 'video_thumb_themat',
|
||||
'overlay' => 'dom-window',
|
||||
'show_thumbnail' => 1,
|
||||
'video_style' => 'normal',
|
||||
),
|
||||
'type' => 'video_embed_field_overlay',
|
||||
'type' => 'video_embed_field_thumbnail',
|
||||
'weight' => 8,
|
||||
),
|
||||
'default' => array(
|
||||
|
||||
@@ -2,4 +2,5 @@ name = Clameurs Mod
|
||||
description = module for clameurs website
|
||||
core = 7.x
|
||||
package = "Clameurs"
|
||||
dependencies[] = panels
|
||||
dependencies[] = video_embed_field
|
||||
dependencies[] = domwindow
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
(function($) {
|
||||
|
||||
Clameurs = function(){
|
||||
|
||||
function init(){
|
||||
console.log("Clameurs");
|
||||
initVideoEvents();
|
||||
}
|
||||
|
||||
function initVideoEvents(){
|
||||
|
||||
$('.field-type-video-embed-field a').on('click', clickVideo);
|
||||
|
||||
};
|
||||
|
||||
function clickVideo(event){
|
||||
event.preventDefault();
|
||||
console.log('Click video', this);
|
||||
var vid_src = $(this).attr('href');
|
||||
console.log("vid_src", vid_src);
|
||||
getEmVidField(vid_src);
|
||||
return false;
|
||||
};
|
||||
|
||||
function getEmVidField(src){
|
||||
$.getJSON('clameursmod/getemvidfield',
|
||||
{'src':src},
|
||||
function(json){
|
||||
console.log("json loaded", json);
|
||||
displayVid(json)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
function displayVid(json){
|
||||
$('#videoframe').remove();
|
||||
|
||||
$vid = $('<div>')
|
||||
.attr('id', 'videoframe')
|
||||
.append(json.embed)
|
||||
.hide()
|
||||
.appendTo('body');
|
||||
|
||||
var iframe = $('iframe', $vid)[0];
|
||||
|
||||
var winwidth = $(window).width();
|
||||
var winheight = $(window).height();
|
||||
console.log('win :'+winwidth+' | '+winheight);
|
||||
|
||||
if (winwidth > winheight) {
|
||||
var w = winwidth*0.9;
|
||||
var h = w*(360/640);
|
||||
}else{
|
||||
var h = winheight*0.9;
|
||||
var w = h*(640/360);
|
||||
}
|
||||
|
||||
console.log('win :'+w+' | '+h);
|
||||
|
||||
$.openDOMWindow({
|
||||
loader:0,
|
||||
windowPadding:10,
|
||||
overlay:1,
|
||||
overlayColor:'#fff',
|
||||
overlayOpacity:'90',
|
||||
borderColor:'transparent',
|
||||
borderSize:'0',
|
||||
width:w,
|
||||
height:h,
|
||||
windowSourceID:"#videoframe"
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var clameurs = new Clameurs();
|
||||
});
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
@@ -1,21 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
*/
|
||||
function clameursmod_init() {
|
||||
if ($path = libraries_get_path('jquery.domwindow')) {
|
||||
// Do something with the library, knowing the path, for instance:
|
||||
drupal_add_js($path . '/jquery.DOMWindow.js');
|
||||
}
|
||||
drupal_add_js(drupal_get_path('module', 'clameursmod').'/clameursmod.js');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
// function clameursmod_menu() {
|
||||
// $items['accueil'] = array(
|
||||
// 'title' => '',
|
||||
// 'page callback' => '',
|
||||
// 'page arguments' => array(),
|
||||
// 'access arguments' => array(''),
|
||||
// 'type' => ,
|
||||
// 'file' => ,
|
||||
// );
|
||||
//
|
||||
// return $items;
|
||||
// }
|
||||
function clameursmod_menu() {
|
||||
|
||||
$items['clameursmod/getemvidfield'] = array(
|
||||
'page callback' => '_clameursmod_getemvidfield',
|
||||
'page arguments' => array(),
|
||||
'access callback' => TRUE,
|
||||
'type' => MENU_CALLBACK,
|
||||
// 'file' => ,
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
function _clameursmod_getemvidfield(){
|
||||
$data = array();
|
||||
$data['test'] = "OK";
|
||||
$data['src'] = $_GET['src'];
|
||||
|
||||
$data['embed'] = theme('video_embed_field_embed_code', array('url'=>$data['src']));
|
||||
|
||||
drupal_json_output($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_entity_info_alter().
|
||||
|
||||
@@ -289,8 +289,9 @@ input {
|
||||
opacity: 1;
|
||||
background-color: rgba(255, 255, 255, 0.9); }
|
||||
|
||||
#DOMWindowOverlay {
|
||||
background-color: #fff !important; }
|
||||
#DOMWindow .embedded-video, #DOMWindow .player, #DOMWindow iframe {
|
||||
width: 100%;
|
||||
height: 100%; }
|
||||
|
||||
#footer-bottom {
|
||||
text-align: center; }
|
||||
|
||||
@@ -360,11 +360,14 @@ body{
|
||||
}
|
||||
|
||||
#DOMWindowOverlay{
|
||||
background-color: #fff!important;
|
||||
// background-color: #fff!important;
|
||||
}
|
||||
|
||||
#DOMWindow{
|
||||
|
||||
.embedded-video, .player ,iframe{
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
}
|
||||
|
||||
#footer{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
|
||||
Drupal.behaviors.init_theme=function(context){$('#messages-and-help > div.messages:not(.processed)').addClass('processed').each(function(){if($('a',this).size()||$(this).is('.error')||$(this).is('.warning')||$(this).text().length>100){$(this).prepend("<span class='close'>X</span>");$('span.close',this).click(function(){$(this).parent().slideUp('fast');});}
|
||||
else{$(this).animate({opacity:1},5000,'linear',function(){$(this).slideUp('fast');});}});};
|
||||
(function($){Drupal.behaviors.init_theme=function(context){$('#messages-and-help > div.messages:not(.processed)').addClass('processed').each(function(){if($('a',this).size()||$(this).is('.error')||$(this).is('.warning')||$(this).text().length>100){$(this).prepend("<span class='close'>X</span>");$('span.close',this).click(function(){$(this).parent().slideUp('fast');});}
|
||||
else{$(this).animate({opacity:1},5000,'linear',function(){$(this).slideUp('fast');});}});};})(jQuery);
|
||||
@@ -1,27 +1,29 @@
|
||||
|
||||
// @codekit-prepend "gui.js"
|
||||
(function($) {
|
||||
|
||||
|
||||
Drupal.behaviors.init_theme = function (context) {
|
||||
// Growl-style system messages
|
||||
$('#messages-and-help > div.messages:not(.processed)')
|
||||
.addClass('processed')
|
||||
.each(function() {
|
||||
// If a message meets these criteria, we don't autoclose
|
||||
// - contains a link
|
||||
// - is an error or warning
|
||||
// - contains a lenghthy amount of text
|
||||
if ($('a', this).size() || $(this).is('.error') || $(this).is('.warning') || $(this).text().length > 100) {
|
||||
$(this).prepend("<span class='close'>X</span>");
|
||||
$('span.close', this).click(function() {
|
||||
$(this).parent().slideUp('fast');
|
||||
});
|
||||
}
|
||||
else {
|
||||
// This essentially adds a 3 second pause before hiding the message.
|
||||
$(this).animate({opacity:1}, 5000, 'linear', function() {
|
||||
$(this).slideUp('fast');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
Drupal.behaviors.init_theme = function (context) {
|
||||
// Growl-style system messages
|
||||
$('#messages-and-help > div.messages:not(.processed)')
|
||||
.addClass('processed')
|
||||
.each(function() {
|
||||
// If a message meets these criteria, we don't autoclose
|
||||
// - contains a link
|
||||
// - is an error or warning
|
||||
// - contains a lenghthy amount of text
|
||||
if ($('a', this).size() || $(this).is('.error') || $(this).is('.warning') || $(this).text().length > 100) {
|
||||
$(this).prepend("<span class='close'>X</span>");
|
||||
$('span.close', this).click(function() {
|
||||
$(this).parent().slideUp('fast');
|
||||
});
|
||||
}
|
||||
else {
|
||||
// This essentially adds a 3 second pause before hiding the message.
|
||||
$(this).animate({opacity:1}, 5000, 'linear', function() {
|
||||
$(this).slideUp('fast');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
/*
|
||||
column css
|
||||
nothing need
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
'title' => t('Column'),
|
||||
'title' => t('1 Column clameur'),
|
||||
'category' => t('Columns: 1'),
|
||||
'icon' => 'column.png',
|
||||
'theme' => 'panels_column',
|
||||
|
||||
Reference in New Issue
Block a user