first import

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-08 11:40:19 +02:00
commit 1bc61b12ad
8435 changed files with 1582817 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
//http://www.featureblend.com/license.txt
var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){obj={activeXError:true};}
return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.minorAtLeast=function(version){return self.minor>=version;};self.revisionAtLeast=function(version){return self.revision>=version;};self.versionAtLeast=function(major){var properties=[self.major,self.minor,self.revision];var len=Math.min(properties.length,arguments.length);for(i=0;i<len;i++){if(properties[i]>=arguments[i]){if(i+1<len&&properties[i]==arguments[i]){continue;}else{return true;}}else{return false;}}};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(!obj.activeXError){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;}}}}}();};FlashDetect.JS_RELEASE="1.0.4";

View File

@@ -0,0 +1,127 @@
/**
* @file
* Create the 'Archive' tab for the WYSIWYG plugins.
*/
// (function ($) {
// namespace('Drupal.media.browser.plugin');
//
// Drupal.media.browser.plugin.media_archive = function(mediaBrowser, options) {
// return {
// init: function() {
// tabset = mediaBrowser.getTabset();
// tabset.tabs('add', '#media_archive', 'Archive');
// mediaBrowser.listen('tabs.show', function (e, id) {
// if (id == 'media_archive') {
// // We only need to set this once.
// // We probably could set it upon load.
// if (mediaBrowser.getActivePanel().html() == '') {
// mediaBrowser.getActivePanel().html(options.media_archive);
// }
// }
// });
// }
// }
// };
//
// // For now, I guess self registration makes sense.
// // Really though, we should be doing it via drupal_add_js and some settings
// // from the drupal variable.
// //@todo: needs a review.
// Drupal.media.browser.register('media_archive', Drupal.media.browser.plugin.media_archive, {});
// })(jQuery);
(function ($) {
namespace('media.browser.plugin');
Drupal.media.browser.plugin.archive_library = function(mediaBrowser, options) {
return {
mediaFiles: [],
init: function() {
tabset = mediaBrowser.getTabset();
tabset.tabs('add', '#archive_library', 'Archive');
var that = this;
mediaBrowser.listen('tabs.show', function (e, id) {
if (id == 'archive_library') {
// This is kinda rough, I'm not sure who should delegate what here.
mediaBrowser.getActivePanel().addClass('throbber');
mediaBrowser.getActivePanel().html('');
//mediaBrowser.getActivePanel().addClass('throbber');
// Assumes we have to refresh everytime.
// Remove any existing content
mediaBrowser.getActivePanel().append('<ul></ul>');
that.browser = $('ul', mediaBrowser.getActivePanel());
that.browser.addClass('clearfix');
that.getMedia();
}
});
},
getStreams: function () {
return ['archive://'];
},
getConditions: function () {
return {};
//return this.settings.conditions;
},
getMedia: function() {
var that = this;
var callback = mediaBrowser.getCallbackUrl('getMedia');
var params = {
conditions: JSON.stringify(this.getConditions()),
streams: JSON.stringify(this.getStreams())
};
jQuery.get(
callback,
params,
function(data, status) {
that.mediaFiles = data.media;
that.emptyMessage = data.empty;
that.pager = data.pager;
that.render();
},
'json'
);
},
render: function() {
var that = this;
mediaBrowser.getActivePanel().removeClass('throbber');
if (this.mediaFiles.length < 1) {
jQuery('<div id="media-empty-message" class="media-empty-message"></div>').appendTo(this.browser)
.html(this.emptyMessage);
return;
}
for (var m in this.mediaFiles) {
mediaFile = this.mediaFiles[m];
var listItem = jQuery('<li></li>').appendTo(this.browser)
.attr('id', 'media-file-' + mediaFile.fid)
.addClass('media-file');
var imgLink = jQuery('<a href="#"></a>').appendTo(listItem)
.html(mediaFile.preview)
.bind('click', mediaFile, function(e) {
// Notify the main browser
//this.selectedMedia = mediaFile;
$('div.media-thumbnail img').removeClass('selected');
$('div.media-thumbnail img', $(this)).addClass('selected');
mediaBrowser.notify('mediaSelected', {mediaFiles: [e.data]});
//that.settings.onSelect(mediaFile);
return false;
});
}
jQuery('<div id="media-pager" class="media-pager"></div>').appendTo(this.browser)
.html(this.pager);
}
};
};
Drupal.media.browser.register('archive_library', Drupal.media.browser.plugin.archive_library);
})(jQuery);

View File

@@ -0,0 +1,99 @@
/**
* @file media_archive/js/media_archive.js
*/
(function ($) {
Drupal.media_archive = {};
Drupal.behaviors.media_archive = {
attach: function (context, settings) {
// Check the browser to see if it supports html5 video.
var video = document.createElement('video');
var html5 = video.canPlayType ? true : false;
// If it has video, does it support the correct codecs?
if (html5) {
html5 = false;
if (video.canPlayType( 'video/webm; codecs="vp8, vorbis"' ) || video.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')) {
html5 = true;
}
}
// Put a prompt in the video wrappers to let users know they need flash
if (!FlashDetect.installed && !html5){
$('.media-archive-preview-wrapper').each(Drupal.media_archive.needFlash);
}
}
};
Drupal.media_archive.needFlash = function () {
var id = $(this).attr('id');
var wrapper = $('.media-archive-preview-wrapper');
var hw = Drupal.settings.media_archive[id].height / Drupal.settings.media_archive[id].width;
wrapper.html('<div class="js-fallback">' + Drupal.t('You need Flash to watch this video. <a href="@flash">Get Flash</a>', {'@flash':'http://get.adobe.com/flashplayer'}) + '</div>');
wrapper.height(wrapper.width() * hw);
};
Drupal.media_archive.insertEmbed = function (embed_id) {
var videoWrapper = $('#' + embed_id + '.media-archive-preview-wrapper');
var settings = Drupal.settings.media_archive[embed_id];
// Calculate the ratio of the dimensions of the embed.
settings.hw = settings.height / settings.width;
// Replace the object embed with Archive's iframe. This isn't done by the
// theme function because Archive doesn't have a no-JS or no-Flash fallback.
var video = $('<iframe class="archive-player" type="text/html" frameborder="0"></iframe>');
var src = 'http://www.archive.org/file/' + settings.video_id;
// Allow other modules to modify the video settings.
settings.options = {wmode : 'opaque'};
$(window).trigger('media_archive_load', settings);
// Merge Archive options (such as autoplay) into the source URL.
var query = $.param(settings.options);
if (query) {
src += '?' + query;
}
// Set up the iframe with its contents and add it to the page.
video
.attr('id', settings.id)
.attr('width', settings.width)
.attr('height', settings.height)
.attr('src', src);
videoWrapper.html(video);
// Bind a resize event to handle fluid layouts.
$(window).bind('resize', Drupal.media_archive.resizeEmbeds);
// For some reason Chrome does not properly size the container around the
// embed and it will just render the embed at full size unless we set this
// timeout.
if (!$('.lightbox-stack').length) {
setTimeout(Drupal.media_archive.resizeEmbeds, 1);
}
};
Drupal.media_archive.resizeEmbeds = function () {
$('.media-archive-preview-wrapper').each(Drupal.media_archive.resizeEmbed);
};
Drupal.media_archive.resizeEmbed = function () {
var context = $(this).parent();
var video = $(this).children(':first-child');
var hw = Drupal.settings.media_archive[$(this).attr('id')].hw;
// Change the height of the wrapper that was given a fixed height by the
// Archive theming function.
$(this)
.height(context.width() * hw)
.width(context.width());
// Change the attributes on the embed to match the new size.
video
.height(context.width() * hw)
.width(context.width());
};
})(jQuery);