Le chargement de tinymce et des webshims est maintenant fonctionnel, y compris avec turbolinks. Ajout d'un spinner pour indiquer le chargement
This commit is contained in:
parent
2b33c37c9b
commit
8532c88097
@ -41,9 +41,6 @@ Puis lancez rails:
|
||||
~ $ bundle exec rails s
|
||||
}}}
|
||||
|
||||
En production, dans le répertoire source, vous devez aussi:
|
||||
~ rake webshims:update_public
|
||||
|
||||
Vous pouvez finalement accéder à l'agenda dans un navigateur à l'URL suivante:
|
||||
http://localhost:3000
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#= require jquery_ujs
|
||||
#= require jquery.turbolinks
|
||||
#= require turbolinks
|
||||
#= require tinymce
|
||||
#= require tinymce-jquery
|
||||
#= require modernizr
|
||||
#= require webshims/polyfiller
|
||||
#= require_tree .
|
||||
@ -22,25 +22,37 @@
|
||||
# Setup polyfills, so that older browsers can also take advanage of html5!
|
||||
#$.webshims.setOptions('basePath', '/assets/webshims/shims/')
|
||||
$.webshims.setOptions('basePath', '/webshims/shims/')
|
||||
$.webshims.polyfill('es5 forms forms-ext mediaelement')
|
||||
$.webshims.polyfill('forms forms-ext')
|
||||
|
||||
$(document).ready ->
|
||||
$(document).on 'page:fetch submit', ->
|
||||
$('em#loading').fadeIn('slow')
|
||||
$(document).on 'page:receive', ->
|
||||
$('em#loading').fadeOut('slow')
|
||||
|
||||
$(document).on 'page:load', ->
|
||||
# Reload polyfill when turbolinks loads a new page
|
||||
$(this).updatePolyfill()
|
||||
|
||||
tinyMCE.init {
|
||||
$(document).on 'page:receive', ->
|
||||
# Delete existing tinymce editors, very important in the turbolinks context!
|
||||
tinymce.remove()
|
||||
|
||||
$(document).ready ->
|
||||
tinyMCE.init
|
||||
selector: 'textarea',
|
||||
language: 'fr_FR',
|
||||
menubar : false,
|
||||
schema: 'html5',
|
||||
add_unload_trigger: true,
|
||||
browser_spellcheck: true,
|
||||
toolbar: [
|
||||
' bold italic strikethrough
|
||||
| bullist numlist outdent indent
|
||||
| alignleft aligncenter alignright alignjustify
|
||||
| link media insertdatetime charmap table
|
||||
| undo redo
|
||||
| searchreplace spellchecker
|
||||
| searchreplace
|
||||
| code visualblocks preview fullscreen'
|
||||
],
|
||||
plugins: 'lists, advlist, autolink, link, charmap, paste, print, preview,
|
||||
table, fullscreen, searchreplace, media, insertdatetime, visualblocks,
|
||||
visualchars, wordcount, contextmenu, code, spellchecker'
|
||||
}
|
||||
visualchars, wordcount, contextmenu, code'
|
||||
|
@ -7,7 +7,6 @@
|
||||
max-width: 100%
|
||||
box-sizing: border-box
|
||||
line-height: 1em
|
||||
@include transition-duration(0.5s)
|
||||
|
||||
html
|
||||
color: black
|
||||
@ -23,6 +22,9 @@ body
|
||||
text-align: center
|
||||
border-bottom: 0px
|
||||
background-color: white
|
||||
header, main, footer
|
||||
*
|
||||
@include transition-duration(0.5s)
|
||||
|
||||
a:link, a:visited
|
||||
color: #258
|
||||
@ -177,3 +179,13 @@ footer.bottom nav
|
||||
color: black
|
||||
content: '- '
|
||||
font-weight: normal
|
||||
|
||||
#loading
|
||||
top: 45%
|
||||
left: 45%
|
||||
color: gray
|
||||
display: none
|
||||
position: fixed
|
||||
font-size: 10vw
|
||||
vertical-align: baseline
|
||||
@include text-shadow(0 0 4px gray)
|
||||
|
@ -33,7 +33,7 @@
|
||||
:markdown
|
||||
#{t '.description_helper'}
|
||||
= f.label :description
|
||||
= f.text_area :description, required: true, rows: 29, cols: 80
|
||||
= f.text_area :description, required: true, rows: 25, cols: 90
|
||||
|
||||
.field
|
||||
= f.label :city
|
||||
|
@ -67,3 +67,5 @@
|
||||
= link_to t('.stats'), stats_regions_url
|
||||
= link_to t('.contact'), application_contact_url
|
||||
= link_to t('.moderation'), moderations_url
|
||||
|
||||
%em#loading.fa.fa-spin.fa-circle-o-notch
|
||||
|
511
public/webshims/extras/modernizr-custom.js
Normal file
511
public/webshims/extras/modernizr-custom.js
Normal file
@ -0,0 +1,511 @@
|
||||
/* Modernizr 2.7.1 (Custom Build) | MIT & BSD
|
||||
* Build: http://modernizr.com/download/#-canvas-audio-video-input-inputtypes-geolocation-shiv-addtest-prefixed-testprop-testallprops-prefixes-domprefixes
|
||||
*/
|
||||
;
|
||||
|
||||
|
||||
|
||||
window.Modernizr = (function( window, document, undefined ) {
|
||||
|
||||
var version = '2.7.1',
|
||||
|
||||
Modernizr = {},
|
||||
|
||||
|
||||
docElement = document.documentElement,
|
||||
|
||||
mod = 'modernizr',
|
||||
modElem = document.createElement(mod),
|
||||
mStyle = modElem.style,
|
||||
|
||||
inputElem = document.createElement('input') ,
|
||||
|
||||
smile = ':)',
|
||||
|
||||
toString = {}.toString,
|
||||
|
||||
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
|
||||
|
||||
|
||||
|
||||
omPrefixes = 'Webkit Moz O ms',
|
||||
|
||||
cssomPrefixes = omPrefixes.split(' '),
|
||||
|
||||
domPrefixes = omPrefixes.toLowerCase().split(' '),
|
||||
|
||||
|
||||
tests = {},
|
||||
inputs = {},
|
||||
attrs = {},
|
||||
|
||||
classes = [],
|
||||
|
||||
slice = classes.slice,
|
||||
|
||||
featureName,
|
||||
|
||||
|
||||
|
||||
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
|
||||
|
||||
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
|
||||
hasOwnProp = function (object, property) {
|
||||
return _hasOwnProperty.call(object, property);
|
||||
};
|
||||
}
|
||||
else {
|
||||
hasOwnProp = function (object, property) {
|
||||
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function bind(that) {
|
||||
|
||||
var target = this;
|
||||
|
||||
if (typeof target != "function") {
|
||||
throw new TypeError();
|
||||
}
|
||||
|
||||
var args = slice.call(arguments, 1),
|
||||
bound = function () {
|
||||
|
||||
if (this instanceof bound) {
|
||||
|
||||
var F = function(){};
|
||||
F.prototype = target.prototype;
|
||||
var self = new F();
|
||||
|
||||
var result = target.apply(
|
||||
self,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
if (Object(result) === result) {
|
||||
return result;
|
||||
}
|
||||
return self;
|
||||
|
||||
} else {
|
||||
|
||||
return target.apply(
|
||||
that,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return bound;
|
||||
};
|
||||
}
|
||||
|
||||
function setCss( str ) {
|
||||
mStyle.cssText = str;
|
||||
}
|
||||
|
||||
function setCssAll( str1, str2 ) {
|
||||
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
|
||||
}
|
||||
|
||||
function is( obj, type ) {
|
||||
return typeof obj === type;
|
||||
}
|
||||
|
||||
function contains( str, substr ) {
|
||||
return !!~('' + str).indexOf(substr);
|
||||
}
|
||||
|
||||
function testProps( props, prefixed ) {
|
||||
for ( var i in props ) {
|
||||
var prop = props[i];
|
||||
if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
|
||||
return prefixed == 'pfx' ? prop : true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function testDOMProps( props, obj, elem ) {
|
||||
for ( var i in props ) {
|
||||
var item = obj[props[i]];
|
||||
if ( item !== undefined) {
|
||||
|
||||
if (elem === false) return props[i];
|
||||
|
||||
if (is(item, 'function')){
|
||||
return item.bind(elem || obj);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function testPropsAll( prop, prefixed, elem ) {
|
||||
|
||||
var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
|
||||
props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
|
||||
|
||||
if(is(prefixed, "string") || is(prefixed, "undefined")) {
|
||||
return testProps(props, prefixed);
|
||||
|
||||
} else {
|
||||
props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
|
||||
return testDOMProps(props, prefixed, elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
tests['canvas'] = function() {
|
||||
var elem = document.createElement('canvas');
|
||||
return !!(elem.getContext && elem.getContext('2d'));
|
||||
}; tests['geolocation'] = function() {
|
||||
return 'geolocation' in navigator;
|
||||
};
|
||||
|
||||
|
||||
tests['video'] = function() {
|
||||
var elem = document.createElement('video'),
|
||||
bool = false;
|
||||
|
||||
try {
|
||||
if ( bool = !!elem.canPlayType ) {
|
||||
bool = new Boolean(bool);
|
||||
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
|
||||
|
||||
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
|
||||
|
||||
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
|
||||
}
|
||||
|
||||
} catch(e) { }
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
tests['audio'] = function() {
|
||||
var elem = document.createElement('audio'),
|
||||
bool = false;
|
||||
|
||||
try {
|
||||
if ( bool = !!elem.canPlayType ) {
|
||||
bool = new Boolean(bool);
|
||||
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
|
||||
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
|
||||
|
||||
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
|
||||
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
|
||||
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
|
||||
}
|
||||
} catch(e) { }
|
||||
|
||||
return bool;
|
||||
}; function webforms() {
|
||||
Modernizr['input'] = (function( props ) {
|
||||
for ( var i = 0, len = props.length; i < len; i++ ) {
|
||||
attrs[ props[i] ] = !!(props[i] in inputElem);
|
||||
}
|
||||
if (attrs.list){
|
||||
attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
|
||||
}
|
||||
return attrs;
|
||||
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
|
||||
Modernizr['inputtypes'] = (function(props) {
|
||||
|
||||
for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
|
||||
|
||||
inputElem.setAttribute('type', inputElemType = props[i]);
|
||||
bool = inputElem.type !== 'text';
|
||||
|
||||
if ( bool ) {
|
||||
|
||||
inputElem.value = smile;
|
||||
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
|
||||
|
||||
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
|
||||
|
||||
docElement.appendChild(inputElem);
|
||||
defaultView = document.defaultView;
|
||||
|
||||
bool = defaultView.getComputedStyle &&
|
||||
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
|
||||
(inputElem.offsetHeight !== 0);
|
||||
|
||||
docElement.removeChild(inputElem);
|
||||
|
||||
} else if ( /^(search|tel)$/.test(inputElemType) ){
|
||||
} else if ( /^(url|email)$/.test(inputElemType) ) {
|
||||
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
|
||||
|
||||
} else {
|
||||
bool = inputElem.value != smile;
|
||||
}
|
||||
}
|
||||
|
||||
inputs[ props[i] ] = !!bool;
|
||||
}
|
||||
return inputs;
|
||||
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
|
||||
}
|
||||
for ( var feature in tests ) {
|
||||
if ( hasOwnProp(tests, feature) ) {
|
||||
featureName = feature.toLowerCase();
|
||||
Modernizr[featureName] = tests[feature]();
|
||||
|
||||
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
|
||||
}
|
||||
}
|
||||
|
||||
Modernizr.input || webforms();
|
||||
|
||||
|
||||
Modernizr.addTest = function ( feature, test ) {
|
||||
if ( typeof feature == 'object' ) {
|
||||
for ( var key in feature ) {
|
||||
if ( hasOwnProp( feature, key ) ) {
|
||||
Modernizr.addTest( key, feature[ key ] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
feature = feature.toLowerCase();
|
||||
|
||||
if ( Modernizr[feature] !== undefined ) {
|
||||
return Modernizr;
|
||||
}
|
||||
|
||||
test = typeof test == 'function' ? test() : test;
|
||||
|
||||
if (typeof enableClasses !== "undefined" && enableClasses) {
|
||||
docElement.className += ' ' + (test ? '' : 'no-') + feature;
|
||||
}
|
||||
Modernizr[feature] = test;
|
||||
|
||||
}
|
||||
|
||||
return Modernizr;
|
||||
};
|
||||
|
||||
|
||||
setCss('');
|
||||
modElem = inputElem = null;
|
||||
|
||||
;(function(window, document) {
|
||||
var version = '3.7.0';
|
||||
|
||||
var options = window.html5 || {};
|
||||
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
var supportsHtml5Styles;
|
||||
|
||||
var expando = '_html5shiv';
|
||||
|
||||
var expanID = 0;
|
||||
|
||||
var expandoData = {};
|
||||
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
getElements().join().replace(/[\w\-]+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
}
|
||||
|
||||
function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
||||
'mark{background:#FF0;color:#000}' +
|
||||
'template{display:none}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
var html5 = {
|
||||
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
|
||||
|
||||
'version': version,
|
||||
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
'type': 'default',
|
||||
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
createElement: createElement,
|
||||
|
||||
createDocumentFragment: createDocumentFragment
|
||||
};
|
||||
|
||||
window.html5 = html5;
|
||||
|
||||
shivDocument(document);
|
||||
|
||||
}(this, document));
|
||||
|
||||
Modernizr._version = version;
|
||||
|
||||
Modernizr._prefixes = prefixes;
|
||||
Modernizr._domPrefixes = domPrefixes;
|
||||
Modernizr._cssomPrefixes = cssomPrefixes;
|
||||
|
||||
|
||||
|
||||
Modernizr.testProp = function(prop){
|
||||
return testProps([prop]);
|
||||
};
|
||||
|
||||
Modernizr.testAllProps = testPropsAll;
|
||||
|
||||
|
||||
Modernizr.prefixed = function(prop, obj, elem){
|
||||
if(!obj) {
|
||||
return testPropsAll(prop, 'pfx');
|
||||
} else {
|
||||
return testPropsAll(prop, obj, elem);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
return Modernizr;
|
||||
|
||||
})(this, this.document);
|
||||
;
|
||||
if(window.console){
|
||||
console.log('webshim no longer depends on Modernizr. You can still use for feature detection of course.');
|
||||
}
|
||||
|
1357
public/webshims/polyfiller.js
Normal file
1357
public/webshims/polyfiller.js
Normal file
File diff suppressed because it is too large
Load Diff
47
public/webshims/shims/FlashCanvas/canvas2png.js
Normal file
47
public/webshims/shims/FlashCanvas/canvas2png.js
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* canvas2png.js
|
||||
*
|
||||
* Copyright (c) 2010-2013 Shinya Muramatsu
|
||||
* Released under the MIT License
|
||||
* http://flashcanvas.net/
|
||||
*/
|
||||
|
||||
(function(doc) {
|
||||
|
||||
var scripts = doc.getElementsByTagName("script");
|
||||
var script = scripts[scripts.length - 1];
|
||||
var url = script.getAttribute("src").replace(/[^\/]+$/, "save.php");
|
||||
|
||||
window.canvas2png = function(canvas, filename) {
|
||||
var tagName = canvas.tagName.toLowerCase();
|
||||
if (tagName !== "canvas") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof FlashCanvas !== "undefined") {
|
||||
FlashCanvas.saveImage(canvas, filename);
|
||||
} else {
|
||||
var action = url;
|
||||
if (filename) {
|
||||
action += "?filename=" + filename;
|
||||
}
|
||||
|
||||
var form = doc.createElement("form");
|
||||
var input = doc.createElement("input");
|
||||
|
||||
form.setAttribute("action", action);
|
||||
form.setAttribute("method", "post");
|
||||
|
||||
input.setAttribute("type", "hidden");
|
||||
input.setAttribute("name", "dataurl");
|
||||
input.setAttribute("value", canvas.toDataURL());
|
||||
|
||||
doc.body.appendChild(form);
|
||||
form.appendChild(input);
|
||||
form.submit();
|
||||
form.removeChild(input);
|
||||
doc.body.removeChild(form);
|
||||
}
|
||||
}
|
||||
|
||||
})(document);
|
54
public/webshims/shims/FlashCanvas/flashcanvas.js
Normal file
54
public/webshims/shims/FlashCanvas/flashcanvas.js
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
window.FlashCanvasOptions = window.FlashCanvasOptions || {};
|
||||
webshims.$.extend(FlashCanvasOptions, {
|
||||
swfPath: webshims.cfg.basePath + 'FlashCanvas/'
|
||||
});
|
||||
|
||||
/*
|
||||
* FlashCanvas
|
||||
*
|
||||
* Copyright (c) 2009 Tim Cameron Ryan
|
||||
* Copyright (c) 2009-2013 FlashCanvas Project
|
||||
* Released under the MIT/X License
|
||||
*/
|
||||
window.ActiveXObject&&!window.CanvasRenderingContext2D&&function(i,j,z){function D(a){this.code=a;this.message=R[a]}function S(a){this.width=a}function v(a){this.id=a.C++}function k(a){this.G=a;this.id=a.C++}function m(a,b){this.canvas=a;this.B=b;this.d=b.id.slice(8);this.D();this.C=0;this.f=this.u="";var c=this;setInterval(function(){o[c.d]===0&&c.e()},30)}function A(){if(j.readyState==="complete"){j.detachEvent(E,A);for(var a=j.getElementsByTagName(r),b=0,c=a.length;b<c;++b)B.initElement(a[b])}}
|
||||
function F(){var a=event.srcElement,b=a.parentNode;a.blur();b.focus()}function G(){var a=event.propertyName;if(a==="width"||a==="height"){var b=event.srcElement,c=b[a],d=parseInt(c,10);if(isNaN(d)||d<0)d=a==="width"?300:150;c===d?(b.style[a]=d+"px",b.getContext("2d").I(b.width,b.height)):b[a]=d}}function H(){i.detachEvent(I,H);for(var a in s){var b=s[a],c=b.firstChild,d;for(d in c)typeof c[d]==="function"&&(c[d]=l);for(d in b)typeof b[d]==="function"&&(b[d]=l);c.detachEvent(J,F);b.detachEvent(K,G)}i[L]=
|
||||
l;i[M]=l;i[N]=l;i[C]=l;i[O]=l}function T(){var a=j.getElementsByTagName("script"),a=a[a.length-1];return j.documentMode>=8?a.src:a.getAttribute("src",4)}function t(a){return(""+a).replace(/&/g,"&").replace(/</g,"<")}function U(a){return a.toLowerCase()}function h(a){throw new D(a);}function P(a){var b=parseInt(a.width,10),c=parseInt(a.height,10);if(isNaN(b)||b<0)b=300;if(isNaN(c)||c<0)c=150;a.width=b;a.height=c}var l=null,r="canvas",L="CanvasRenderingContext2D",M="CanvasGradient",N="CanvasPattern",
|
||||
C="FlashCanvas",O="G_vmlCanvasManager",J="onfocus",K="onpropertychange",E="onreadystatechange",I="onunload",w=((i[C+"Options"]||{}).swfPath||T().replace(/[^\/]+$/,""))+"flashcanvas.swf",e=new function(a){for(var b=0,c=a.length;b<c;b++)this[a[b]]=b}("toDataURL,save,restore,scale,rotate,translate,transform,setTransform,globalAlpha,globalCompositeOperation,strokeStyle,fillStyle,createLinearGradient,createRadialGradient,createPattern,lineWidth,lineCap,lineJoin,miterLimit,shadowOffsetX,shadowOffsetY,shadowBlur,shadowColor,clearRect,fillRect,strokeRect,beginPath,closePath,moveTo,lineTo,quadraticCurveTo,bezierCurveTo,arcTo,rect,arc,fill,stroke,clip,isPointInPath,font,textAlign,textBaseline,fillText,strokeText,measureText,drawImage,createImageData,getImageData,putImageData,addColorStop,direction,resize".split(",")),
|
||||
u={},p={},o={},x={},s={},y={};m.prototype={save:function(){this.b();this.c();this.n();this.m();this.z();this.w();this.F.push([this.g,this.h,this.A,this.v,this.k,this.i,this.j,this.l,this.q,this.r,this.o,this.p,this.f,this.s,this.t]);this.a.push(e.save)},restore:function(){var a=this.F;if(a.length)a=a.pop(),this.globalAlpha=a[0],this.globalCompositeOperation=a[1],this.strokeStyle=a[2],this.fillStyle=a[3],this.lineWidth=a[4],this.lineCap=a[5],this.lineJoin=a[6],this.miterLimit=a[7],this.shadowOffsetX=
|
||||
a[8],this.shadowOffsetY=a[9],this.shadowBlur=a[10],this.shadowColor=a[11],this.font=a[12],this.textAlign=a[13],this.textBaseline=a[14];this.a.push(e.restore)},scale:function(a,b){this.a.push(e.scale,a,b)},rotate:function(a){this.a.push(e.rotate,a)},translate:function(a,b){this.a.push(e.translate,a,b)},transform:function(a,b,c,d,f,g){this.a.push(e.transform,a,b,c,d,f,g)},setTransform:function(a,b,c,d,f,g){this.a.push(e.setTransform,a,b,c,d,f,g)},b:function(){var a=this.a;if(this.g!==this.globalAlpha)this.g=
|
||||
this.globalAlpha,a.push(e.globalAlpha,this.g);if(this.h!==this.globalCompositeOperation)this.h=this.globalCompositeOperation,a.push(e.globalCompositeOperation,this.h)},n:function(){if(this.A!==this.strokeStyle){var a=this.A=this.strokeStyle;if(typeof a!=="string")if(a instanceof k||a instanceof v)a=a.id;else return;this.a.push(e.strokeStyle,a)}},m:function(){if(this.v!==this.fillStyle){var a=this.v=this.fillStyle;if(typeof a!=="string")if(a instanceof k||a instanceof v)a=a.id;else return;this.a.push(e.fillStyle,
|
||||
a)}},createLinearGradient:function(a,b,c,d){(!isFinite(a)||!isFinite(b)||!isFinite(c)||!isFinite(d))&&h(9);this.a.push(e.createLinearGradient,a,b,c,d);return new k(this)},createRadialGradient:function(a,b,c,d,f,g){(!isFinite(a)||!isFinite(b)||!isFinite(c)||!isFinite(d)||!isFinite(f)||!isFinite(g))&&h(9);(c<0||g<0)&&h(1);this.a.push(e.createRadialGradient,a,b,c,d,f,g);return new k(this)},createPattern:function(a,b){a||h(17);var c=a.tagName,d,f=this.d;if(c)if(c=c.toLowerCase(),c==="img")d=a.getAttribute("src",
|
||||
2);else if(c===r||c==="video")return;else h(17);else a.src?d=a.src:h(17);b==="repeat"||b==="no-repeat"||b==="repeat-x"||b==="repeat-y"||b===""||b===l||h(12);this.a.push(e.createPattern,t(d),b);!p[f][d]&&u[f]&&(this.e(),++o[f],p[f][d]=!0);return new v(this)},z:function(){var a=this.a;if(this.k!==this.lineWidth)this.k=this.lineWidth,a.push(e.lineWidth,this.k);if(this.i!==this.lineCap)this.i=this.lineCap,a.push(e.lineCap,this.i);if(this.j!==this.lineJoin)this.j=this.lineJoin,a.push(e.lineJoin,this.j);
|
||||
if(this.l!==this.miterLimit)this.l=this.miterLimit,a.push(e.miterLimit,this.l)},c:function(){var a=this.a;if(this.q!==this.shadowOffsetX)this.q=this.shadowOffsetX,a.push(e.shadowOffsetX,this.q);if(this.r!==this.shadowOffsetY)this.r=this.shadowOffsetY,a.push(e.shadowOffsetY,this.r);if(this.o!==this.shadowBlur)this.o=this.shadowBlur,a.push(e.shadowBlur,this.o);if(this.p!==this.shadowColor)this.p=this.shadowColor,a.push(e.shadowColor,this.p)},clearRect:function(a,b,c,d){this.a.push(e.clearRect,a,b,c,
|
||||
d)},fillRect:function(a,b,c,d){this.b();this.c();this.m();this.a.push(e.fillRect,a,b,c,d)},strokeRect:function(a,b,c,d){this.b();this.c();this.n();this.z();this.a.push(e.strokeRect,a,b,c,d)},beginPath:function(){this.a.push(e.beginPath)},closePath:function(){this.a.push(e.closePath)},moveTo:function(a,b){this.a.push(e.moveTo,a,b)},lineTo:function(a,b){this.a.push(e.lineTo,a,b)},quadraticCurveTo:function(a,b,c,d){this.a.push(e.quadraticCurveTo,a,b,c,d)},bezierCurveTo:function(a,b,c,d,f,g){this.a.push(e.bezierCurveTo,
|
||||
a,b,c,d,f,g)},arcTo:function(a,b,c,d,f){f<0&&isFinite(f)&&h(1);this.a.push(e.arcTo,a,b,c,d,f)},rect:function(a,b,c,d){this.a.push(e.rect,a,b,c,d)},arc:function(a,b,c,d,f,g){c<0&&isFinite(c)&&h(1);this.a.push(e.arc,a,b,c,d,f,g?1:0)},fill:function(){this.b();this.c();this.m();this.a.push(e.fill)},stroke:function(){this.b();this.c();this.n();this.z();this.a.push(e.stroke)},clip:function(){this.a.push(e.clip)},w:function(){var a=this.a;if(this.f!==this.font)try{var b=y[this.d];b.style.font=this.f=this.font;
|
||||
var c=b.currentStyle;a.push(e.font,[c.fontStyle,c.fontWeight,b.offsetHeight,c.fontFamily].join(" "))}catch(d){}if(this.s!==this.textAlign)this.s=this.textAlign,a.push(e.textAlign,this.s);if(this.t!==this.textBaseline)this.t=this.textBaseline,a.push(e.textBaseline,this.t);if(this.u!==this.canvas.currentStyle.direction)this.u=this.canvas.currentStyle.direction,a.push(e.direction,this.u)},fillText:function(a,b,c,d){this.b();this.m();this.c();this.w();this.a.push(e.fillText,t(a),b,c,d===z?Infinity:d)},
|
||||
strokeText:function(a,b,c,d){this.b();this.n();this.c();this.w();this.a.push(e.strokeText,t(a),b,c,d===z?Infinity:d)},measureText:function(a){var b=y[this.d];try{b.style.font=this.font}catch(c){}b.innerText=(""+a).replace(/[ \n\f\r]/g,"\t");return new S(b.offsetWidth)},drawImage:function(a,b,c,d,f,g,i,j,l){a||h(17);var k=a.tagName,n,q=arguments.length,m=this.d;if(k)if(k=k.toLowerCase(),k==="img")n=a.getAttribute("src",2);else if(k===r||k==="video")return;else h(17);else a.src?n=a.src:h(17);this.b();
|
||||
this.c();n=t(n);if(q===3)this.a.push(e.drawImage,q,n,b,c);else if(q===5)this.a.push(e.drawImage,q,n,b,c,d,f);else if(q===9)(d===0||f===0)&&h(1),this.a.push(e.drawImage,q,n,b,c,d,f,g,i,j,l);else return;!p[m][n]&&u[m]&&(this.e(),++o[m],p[m][n]=!0)},loadImage:function(a,b,c){var d=a.tagName,f,g=this.d;if(d)d.toLowerCase()==="img"&&(f=a.getAttribute("src",2));else if(a.src)f=a.src;if(f&&!p[g][f]){if(b||c)x[g][f]=[a,b,c];this.a.push(e.drawImage,1,t(f));u[g]&&(this.e(),++o[g],p[g][f]=!0)}},D:function(){this.globalAlpha=
|
||||
this.g=1;this.globalCompositeOperation=this.h="source-over";this.fillStyle=this.v=this.strokeStyle=this.A="#000000";this.lineWidth=this.k=1;this.lineCap=this.i="butt";this.lineJoin=this.j="miter";this.miterLimit=this.l=10;this.shadowBlur=this.o=this.shadowOffsetY=this.r=this.shadowOffsetX=this.q=0;this.shadowColor=this.p="rgba(0, 0, 0, 0.0)";this.font=this.f="10px sans-serif";this.textAlign=this.s="start";this.textBaseline=this.t="alphabetic";this.a=[];this.F=[]},H:function(){var a=this.a;this.a=
|
||||
[];return a},e:function(){var a=this.H();if(a.length>0)return eval(this.B.CallFunction('<invoke name="executeCommand" returntype="javascript"><arguments><string>'+a.join("�")+"</string></arguments></invoke>"))},I:function(a,b){this.e();this.D();if(a>0)this.B.width=a;if(b>0)this.B.height=b;this.a.push(e.resize,a,b)}};k.prototype={addColorStop:function(a,b){(isNaN(a)||a<0||a>1)&&h(1);this.G.a.push(e.addColorStop,this.id,a,b)}};D.prototype=Error();var R={1:"INDEX_SIZE_ERR",9:"NOT_SUPPORTED_ERR",11:"INVALID_STATE_ERR",
|
||||
12:"SYNTAX_ERR",17:"TYPE_MISMATCH_ERR",18:"SECURITY_ERR"},B={initElement:function(a){if(a.getContext)return a;var b=Math.random().toString(36).slice(2)||"0",c="external"+b;u[b]=!1;p[b]={};o[b]=1;x[b]={};P(a);a.innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+location.protocol+'//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="'+c+'"><param name="allowScriptAccess" value="always"><param name="flashvars" value="id='+
|
||||
c+'"><param name="wmode" value="transparent"></object><span style="margin:0;padding:0;border:0;display:inline-block;position:static;height:1em;overflow:visible;white-space:nowrap"></span>';s[b]=a;var d=a.firstChild;y[b]=a.lastChild;var f=j.body.contains;if(f(a))d.movie=w;else var g=setInterval(function(){if(f(a))clearInterval(g),d.movie=w},0);if(j.compatMode==="BackCompat"||!i.XMLHttpRequest)y[b].style.overflow="hidden";var h=new m(a,d);a.getContext=function(a){return a==="2d"?h:l};a.toDataURL=function(a,
|
||||
b){(""+a).replace(/[A-Z]+/g,U)==="image/jpeg"?h.a.push(e.toDataURL,a,typeof b==="number"?b:""):h.a.push(e.toDataURL,a);return h.e()};d.attachEvent(J,F);return a},saveImage:function(a,b){a.firstChild.saveImage(b)},setOptions:function(){},trigger:function(a,b){s[a].fireEvent("on"+b)},unlock:function(a,b,c){var d,e,g;o[a]&&--o[a];if(b===z){d=s[a];b=d.firstChild;P(d);e=d.width;c=d.height;d.style.width=e+"px";d.style.height=c+"px";if(e>0)b.width=e;if(c>0)b.height=c;b.resize(e,c);d.attachEvent(K,G);u[a]=
|
||||
!0;typeof d.onload==="function"&&setTimeout(function(){d.onload()},0)}else if(g=x[a][b])e=g[0],c=g[1+c],delete x[a][b],typeof c==="function"&&c.call(e)}};j.createElement(r);j.createStyleSheet().cssText=r+"{display:inline-block;overflow:hidden;width:300px;height:150px}";j.readyState==="complete"?A():j.attachEvent(E,A);i.attachEvent(I,H);if(w.indexOf(location.protocol+"//"+location.host+"/")===0){var Q=new ActiveXObject("Microsoft.XMLHTTP");Q.open("GET",w,!1);Q.send(l)}i[L]=m;i[M]=k;i[N]=v;i[C]=B;i[O]=
|
||||
{init:function(){},init_:function(){},initElement:B.initElement};keep=[m.measureText,m.loadImage]}(window,document);
|
||||
|
||||
|
||||
|
||||
(function(document){
|
||||
webshims.addReady(function(context, elem){
|
||||
if(context == document){
|
||||
if(window.G_vmlCanvasManager && G_vmlCanvasManager.init_ ){
|
||||
G_vmlCanvasManager.init_(document);
|
||||
}
|
||||
}
|
||||
webshims.$('canvas', context).add(elem.filter('canvas')).each(function(){
|
||||
var hasContext = this.getContext;
|
||||
if(!hasContext && window.G_vmlCanvasManager){
|
||||
G_vmlCanvasManager.initElement(this);
|
||||
}
|
||||
});
|
||||
});
|
||||
webshims.isReady('canvas', true);
|
||||
})(document);
|
BIN
public/webshims/shims/FlashCanvas/flashcanvas.swf
Normal file
BIN
public/webshims/shims/FlashCanvas/flashcanvas.swf
Normal file
Binary file not shown.
94
public/webshims/shims/FlashCanvas/proxy.php
Normal file
94
public/webshims/shims/FlashCanvas/proxy.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy script to load a file from other domain
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 2010-2013 Shinya Muramatsu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* @author Shinya Muramatsu <revulon@gmail.com>
|
||||
* @copyright 2010-2013 Shinya Muramatsu
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
* @link http://flashcanvas.net/
|
||||
* @link http://code.google.com/p/flashcanvas/
|
||||
*/
|
||||
|
||||
function getHostName() {
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||
return $_SERVER['HTTP_X_FORWARDED_HOST'];
|
||||
} else if (isset($_SERVER['HTTP_HOST'])) {
|
||||
return $_SERVER['HTTP_HOST'];
|
||||
} else {
|
||||
return $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
}
|
||||
|
||||
// Whether we check referrer or not
|
||||
define('CHECK_REFERRER', true);
|
||||
|
||||
// If necessary, specify the host where the SWF file is located
|
||||
define('SWF_HOST_NAME', '');
|
||||
|
||||
// Check that the request comes from the same host
|
||||
if (CHECK_REFERRER) {
|
||||
if (empty($_SERVER['HTTP_REFERER'])) {
|
||||
exit;
|
||||
}
|
||||
if (SWF_HOST_NAME) {
|
||||
$host = SWF_HOST_NAME;
|
||||
} else {
|
||||
$host = getHostName();
|
||||
}
|
||||
$pattern = '#^https?://' . str_replace('.', '\.', $host) . '(:\d*)?/#';
|
||||
if (!preg_match($pattern, $_SERVER['HTTP_REFERER'])) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that the request has a valid URL parameter
|
||||
if (empty($_GET['url'])) {
|
||||
exit;
|
||||
}
|
||||
if (!preg_match('#^https?://#', $_GET['url'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Percent-encode special characters in the URL
|
||||
$search = array( '%', '#', ' ');
|
||||
$replace = array('%25', '%23', '%20');
|
||||
$url = str_replace($search, $replace, $_GET['url']);
|
||||
|
||||
// Disable compression
|
||||
header('Content-Encoding: none');
|
||||
|
||||
// Load and output the file
|
||||
if (extension_loaded('curl')) {
|
||||
// Use cURL extension
|
||||
$ch = curl_init($url);
|
||||
// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
// curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
} else {
|
||||
// Use the http:// wrapper
|
||||
readfile($url);
|
||||
}
|
55
public/webshims/shims/FlashCanvas/save.php
Normal file
55
public/webshims/shims/FlashCanvas/save.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Save the input as a PNG file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 2010-2013 Shinya Muramatsu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* @author Shinya Muramatsu <revulon@gmail.com>
|
||||
* @copyright 2010-2013 Shinya Muramatsu
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
* @link http://flashcanvas.net/
|
||||
* @link http://code.google.com/p/flashcanvas/
|
||||
*/
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (isset($_GET['filename'])) {
|
||||
$filename = $_GET['filename'];
|
||||
} else {
|
||||
$filename = 'canvas.png';
|
||||
}
|
||||
|
||||
// Force download
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||
|
||||
if (isset($_POST['dataurl'])) {
|
||||
// Decode the base64-encoded data
|
||||
$data = $_POST['dataurl'];
|
||||
$data = substr($data, strpos($data, ',') + 1);
|
||||
echo base64_decode($data);
|
||||
} else {
|
||||
// Output the raw data
|
||||
readfile('php://input');
|
||||
}
|
||||
}
|
47
public/webshims/shims/FlashCanvasPro/canvas2png.js
Normal file
47
public/webshims/shims/FlashCanvasPro/canvas2png.js
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* canvas2png.js
|
||||
*
|
||||
* Copyright (c) 2010-2013 Shinya Muramatsu
|
||||
* Released under the MIT License
|
||||
* http://flashcanvas.net/
|
||||
*/
|
||||
|
||||
(function(doc) {
|
||||
|
||||
var scripts = doc.getElementsByTagName("script");
|
||||
var script = scripts[scripts.length - 1];
|
||||
var url = script.getAttribute("src").replace(/[^\/]+$/, "save.php");
|
||||
|
||||
window.canvas2png = function(canvas, filename) {
|
||||
var tagName = canvas.tagName.toLowerCase();
|
||||
if (tagName !== "canvas") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof FlashCanvas !== "undefined") {
|
||||
FlashCanvas.saveImage(canvas, filename);
|
||||
} else {
|
||||
var action = url;
|
||||
if (filename) {
|
||||
action += "?filename=" + filename;
|
||||
}
|
||||
|
||||
var form = doc.createElement("form");
|
||||
var input = doc.createElement("input");
|
||||
|
||||
form.setAttribute("action", action);
|
||||
form.setAttribute("method", "post");
|
||||
|
||||
input.setAttribute("type", "hidden");
|
||||
input.setAttribute("name", "dataurl");
|
||||
input.setAttribute("value", canvas.toDataURL());
|
||||
|
||||
doc.body.appendChild(form);
|
||||
form.appendChild(input);
|
||||
form.submit();
|
||||
form.removeChild(input);
|
||||
doc.body.removeChild(form);
|
||||
}
|
||||
}
|
||||
|
||||
})(document);
|
BIN
public/webshims/shims/FlashCanvasPro/flash10canvas.swf
Normal file
BIN
public/webshims/shims/FlashCanvasPro/flash10canvas.swf
Normal file
Binary file not shown.
BIN
public/webshims/shims/FlashCanvasPro/flash9canvas.swf
Normal file
BIN
public/webshims/shims/FlashCanvasPro/flash9canvas.swf
Normal file
Binary file not shown.
57
public/webshims/shims/FlashCanvasPro/flashcanvas.js
Normal file
57
public/webshims/shims/FlashCanvasPro/flashcanvas.js
Normal file
@ -0,0 +1,57 @@
|
||||
window.FlashCanvasOptions = window.FlashCanvasOptions || {};
|
||||
webshims.$.extend(FlashCanvasOptions, {
|
||||
swfPath: webshims.cfg.basePath + 'FlashCanvasPro/'
|
||||
});
|
||||
|
||||
/*
|
||||
* FlashCanvas Pro
|
||||
*
|
||||
* Copyright (c) 2009 Tim Cameron Ryan
|
||||
* Copyright (c) 2009-2013 Shinya Muramatsu
|
||||
*/
|
||||
window.ActiveXObject&&!window.CanvasRenderingContext2D&&function(l,k,q){function O(a){this.code=a;this.message=ga[a]}function w(a,b,c){if(!c)for(var c=[],d=0,e=a*b*4;d<e;++d)c[d]=0;this.width=a;this.height=b;this.data=c}function ha(a){this.width=a}function x(a){this.id=a.F++}function o(a){this.J=a;this.id=a.F++}function A(a,b){this.canvas=a;this.z=b;this.e=b.id.slice(8);this.G();this.F=0;this.j=this.D="";this.d=0}function B(){if(k.readyState==="complete"){k.detachEvent(P,B);for(var a=k.getElementsByTagName(r),
|
||||
b=0,c=a.length;b<c;++b)C.initElement(a[b])}}function Q(){var a=event.srcElement,b=a.parentNode;a.blur();b.focus()}function D(){event.button&2&&event.srcElement.parentNode.setCapture()}function E(){event.button&2&&event.srcElement.parentNode.releaseCapture()}function R(){var a=event.propertyName;if(a==="width"||a==="height"){var b=event.srcElement,c=b[a],d=parseInt(c,10);if(isNaN(d)||d<0)d=a==="width"?300:150;c===d?(b.style[a]=d+"px",b.getContext("2d").K(b.width,b.height)):b[a]=d}}function S(){l.detachEvent(T,
|
||||
S);for(var a in m){var b=m[a],c=b.firstChild,d;for(d in c)typeof c[d]==="function"&&(c[d]=g);for(d in b)typeof b[d]==="function"&&(b[d]=g);c.detachEvent(U,Q);c.detachEvent(F,D);b.detachEvent(G,E);b.detachEvent(V,R)}l[W]=g;l[X]=g;l[Y]=g;l[H]=g;l[Z]=g}function ia(a){return a.toLowerCase()}function i(a){throw new O(a);}function $(a){var b=parseInt(a.width,10),c=parseInt(a.height,10);if(isNaN(b)||b<0)b=300;if(isNaN(c)||c<0)c=150;a.width=b;a.height=c}function I(a,b){for(var c in m){var d=m[c].getContext("2d");
|
||||
d.g.push(d.a.length+2);d.a.push(y,a,b)}}var g=null,r="canvas",W="CanvasRenderingContext2D",X="CanvasGradient",Y="CanvasPattern",H="FlashCanvas",Z="G_vmlCanvasManager",U="onfocus",F="onmousedown",G="onmouseup",V="onpropertychange",P="onreadystatechange",T="onunload",n;try{n=(new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").match(/[\d,]+/)[0].replace(/,/g,".")}catch(ka){n=0}var j=l[H+"Options"]||{},J=function(){var a=k.getElementsByTagName("script"),a=a[a.length-1];return k.documentMode>=
|
||||
8?a.src:a.getAttribute("src",4)}().replace(/[^\/]+$/,""),t=j.swfPath||J;t+=parseInt(n)>9?"flash10canvas.swf":"flash9canvas.swf";var y="4",s={},u={},aa={},K={},p={},ba={},v={},m={},z={},J="autoinit"in j?j.autoinit:1,L="turbo"in j?j.turbo:1,M=j.delay||0,ca=j.disableContextMenu||0,da=j.imageCacheSize||100,N=j.usePolicyFile||0,ea=j.proxy||"proxy.php",fa=j.save||"save.php";n==="10.1.53.64"&&(L=0,M=30);A.prototype={save:function(){this.h(15);this.I.push([this.m,this.n,this.w,this.l,this.q,this.o,this.p,
|
||||
this.r,this.u,this.v,this.s,this.t,this.j,this.A,this.B]);this.a.push("B")},restore:function(){var a=this.I;if(a.length)a=a.pop(),this.globalAlpha=a[0],this.globalCompositeOperation=a[1],this.strokeStyle=a[2],this.fillStyle=a[3],this.lineWidth=a[4],this.lineCap=a[5],this.lineJoin=a[6],this.miterLimit=a[7],this.shadowOffsetX=a[8],this.shadowOffsetY=a[9],this.shadowBlur=a[10],this.shadowColor=a[11],this.font=a[12],this.textAlign=a[13],this.textBaseline=a[14];this.a.push("C")},scale:function(a,b){this.a.push("D",
|
||||
a,b)},rotate:function(a){this.a.push("E",a)},translate:function(a,b){this.a.push("F",a,b)},transform:function(a,b,c,d,e,f){this.a.push("G",a,b,c,d,e,f)},setTransform:function(a,b,c,d,e,f){this.a.push("H",a,b,c,d,e,f)},createLinearGradient:function(a,b,c,d){(!isFinite(a)||!isFinite(b)||!isFinite(c)||!isFinite(d))&&i(9);this.a.push("M",a,b,c,d);return new o(this)},createRadialGradient:function(a,b,c,d,e,f){(!isFinite(a)||!isFinite(b)||!isFinite(c)||!isFinite(d)||!isFinite(e)||!isFinite(f))&&i(9);(c<
|
||||
0||f<0)&&i(1);this.a.push("N",a,b,c,d,e,f);return new o(this)},createPattern:function(a,b){a||i(17);var c=a.tagName,d,e,f,h=this.e;if(c)if(c=c.toLowerCase(),c==="img")d=a.getAttribute("src",2);else if(c===r)e=this.C(a),f=a!==this.canvas;else if(c==="video")return;else i(17);else a.src?d=a.src:i(17);b==="repeat"||b==="no-repeat"||b==="repeat-x"||b==="repeat-y"||b===""||b===g||i(12);e||(e=u[h][d],(f=e===q)&&(e=this.k(d)));this.a.push("O",e,b);f&&s[h]&&(this.f(),++p[h]);return new x(this)},clearRect:function(a,
|
||||
b,c,d){this.a.push("X",a,b,c,d);this.b||this.c();this.d=0},fillRect:function(a,b,c,d){this.h(1);this.a.push("Y",a,b,c,d);this.b||this.c();this.d=0},strokeRect:function(a,b,c,d){this.h(6);this.a.push("Z",a,b,c,d);this.b||this.c();this.d=0},beginPath:function(){this.a.push("a")},closePath:function(){this.a.push("b")},moveTo:function(a,b){this.a.push("c",a,b)},lineTo:function(a,b){this.a.push("d",a,b)},quadraticCurveTo:function(a,b,c,d){this.a.push("e",a,b,c,d)},bezierCurveTo:function(a,b,c,d,e,f){this.a.push("f",
|
||||
a,b,c,d,e,f)},arcTo:function(a,b,c,d,e){e<0&&isFinite(e)&&i(1);this.a.push("g",a,b,c,d,e)},rect:function(a,b,c,d){this.a.push("h",a,b,c,d)},arc:function(a,b,c,d,e,f){c<0&&isFinite(c)&&i(1);this.a.push("i",a,b,c,d,e,f?1:0)},fill:function(){this.h(1);this.a.push("j");this.b||this.c();this.d=0},stroke:function(){this.h(6);this.a.push("k");this.b||this.c();this.d=0},clip:function(){this.a.push("l")},isPointInPath:function(a,b){this.a.push("m",a,b);return this.f()==="true"},fillText:function(a,b,c,d){this.h(9);
|
||||
this.g.push(this.a.length+1);this.a.push("r",a,b,c,d===q?Infinity:d);this.b||this.c();this.d=0},strokeText:function(a,b,c,d){this.h(10);this.g.push(this.a.length+1);this.a.push("s",a,b,c,d===q?Infinity:d);this.b||this.c();this.d=0},measureText:function(a){var b=z[this.e];try{b.style.font=this.font}catch(c){}b.innerText=(""+a).replace(/[ \n\f\r]/g,"\t");return new ha(b.offsetWidth)},drawImage:function(a,b,c,d,e,f,h,ja,l){a||i(17);var g=a.tagName,k,j,m,n=arguments.length,o=this.e;if(g)if(g=g.toLowerCase(),
|
||||
g==="img")k=a.getAttribute("src",2);else if(g===r)j=this.C(a),m=a!==this.canvas;else if(g==="video")return;else i(17);else a.src?k=a.src:i(17);j||(j=u[o][k],(m=j===q)&&(j=this.k(k)));this.h(0);if(n===3)this.a.push("u",n,j,b,c);else if(n===5)this.a.push("u",n,j,b,c,d,e);else if(n===9)(d===0||e===0)&&i(1),this.a.push("u",n,j,b,c,d,e,f,h,ja,l);else return;m&&s[o]?(this.f(),++p[o]):this.b||this.c();this.d=0},createImageData:function(a,b){var c=Math.ceil;arguments.length===2?((!isFinite(a)||!isFinite(b))&&
|
||||
i(9),(a===0||b===0)&&i(1)):(a instanceof w||i(9),b=a.height,a=a.width);a=c(a<0?-a:a);b=c(b<0?-b:b);return new w(a,b)},getImageData:function(a,b,c,d){(!isFinite(a)||!isFinite(b)||!isFinite(c)||!isFinite(d))&&i(9);(c===0||d===0)&&i(1);this.a.push("w",a,b,c,d);a=this.f();c=typeof JSON==="object"?JSON.parse(a):k.documentMode?eval(a):a.slice(1,-1).split(",");a=c.shift();b=c.shift();return new w(a,b,c)},putImageData:function(a,b,c,d,e,f,h){a instanceof w||i(17);(!isFinite(b)||!isFinite(c))&&i(9);var g=
|
||||
arguments.length,j=a.width,k=a.height,l=a.data;g===3?this.a.push("x",g,j,k,l.toString(),b,c):g===7&&((!isFinite(d)||!isFinite(e)||!isFinite(f)||!isFinite(h))&&i(9),this.a.push("x",g,j,k,l.toString(),b,c,d,e,f,h));this.b||this.c();this.d=0},loadFont:function(a,b,c){var d=this.e;if(b||c)v[d][a]=[a,b,c];this.g.push(this.a.length+1);this.a.push("6",a);s[d]?(this.f(),++p[d]):this.b||this.c()},loadImage:function(a,b,c){var d=a.tagName,e,f=this.e;if(d)d.toLowerCase()==="img"&&(e=a.getAttribute("src",2));
|
||||
else if(a.src)e=a.src;if(e&&u[f][e]===q){d=this.k(e);if(b||c)v[f][d]=[a,b,c];this.a.push("u",1,d);s[f]&&(this.f(),++p[f])}},G:function(){this.globalAlpha=this.m=1;this.globalCompositeOperation=this.n="source-over";this.fillStyle=this.l=this.strokeStyle=this.w="#000000";this.lineWidth=this.q=1;this.lineCap=this.o="butt";this.lineJoin=this.p="miter";this.miterLimit=this.r=10;this.shadowBlur=this.s=this.shadowOffsetY=this.v=this.shadowOffsetX=this.u=0;this.shadowColor=this.t="rgba(0, 0, 0, 0.0)";this.font=
|
||||
this.j="10px sans-serif";this.textAlign=this.A="start";this.textBaseline=this.B="alphabetic";this.a=[];this.I=[];this.i=[];this.g=[];this.b=g;this.H=1},h:function(a){var b=this.a,c;if(this.m!==this.globalAlpha)b.push("I",this.m=this.globalAlpha);if(this.n!==this.globalCompositeOperation)b.push("J",this.n=this.globalCompositeOperation);if(this.u!==this.shadowOffsetX)b.push("T",this.u=this.shadowOffsetX);if(this.v!==this.shadowOffsetY)b.push("U",this.v=this.shadowOffsetY);if(this.s!==this.shadowBlur)b.push("V",
|
||||
this.s=this.shadowBlur);if(this.t!==this.shadowColor)c=this.t=this.shadowColor,(""+c).indexOf("%")>0&&this.i.push(b.length+1),b.push("W",c);if(a&1&&this.l!==this.fillStyle)c=this.l=this.fillStyle,typeof c==="string"?(c.indexOf("%")>0&&this.i.push(b.length+1),b.push("L",c)):(c instanceof o||c instanceof x)&&b.push("L",c.id);if(a&2&&this.w!==this.strokeStyle)c=this.w=this.strokeStyle,typeof c==="string"?(c.indexOf("%")>0&&this.i.push(b.length+1),b.push("K",c)):(c instanceof o||c instanceof x)&&b.push("K",
|
||||
c.id);if(a&4){if(this.q!==this.lineWidth)b.push("P",this.q=this.lineWidth);if(this.o!==this.lineCap)b.push("Q",this.o=this.lineCap);if(this.p!==this.lineJoin)b.push("R",this.p=this.lineJoin);if(this.r!==this.miterLimit)b.push("S",this.r=this.miterLimit)}if(a&8){if(this.j!==this.font)a=z[this.e].offsetHeight,this.g.push(b.length+2),b.push("o",a,this.j=this.font);if(this.A!==this.textAlign)b.push("p",this.A=this.textAlign);if(this.B!==this.textBaseline)b.push("q",this.B=this.textBaseline);if(this.D!==
|
||||
this.canvas.currentStyle.direction)b.push("1",this.D=this.canvas.currentStyle.direction)}},c:function(){var a=this;a.b=setTimeout(function(){p[a.e]?a.c():(a.b=g,a.f(L))},M)},L:function(){clearTimeout(this.b);this.b=g},f:function(a){var b,c,d,e=this.i,f=this.g,h=this.a,g=this.z;if(h.length){this.b&&this.L();if(a){for(b=0,c=e.length;b<c;++b)d=e[b],h[d]=encodeURI(h[d]);for(b=0,c=f.length;b<c;++b)d=f[b],h[d]=encodeURIComponent(h[d])}else for(b=0,c=f.length;b<c;++b)d=f[b],h[d]=(""+h[d]).replace(/&/g,"&").replace(/</g,
|
||||
"<");b=h.join("\u0001");this.a=[];this.i=[];this.g=[];if(a)g.flashvars="c="+b,g.width=g.clientWidth+this.H,this.H^=-2;else return g.CallFunction('<invoke name="executeCommand" returntype="javascript"><arguments><string>'+b+"</string></arguments></invoke>")}},K:function(a,b){this.f();this.G();if(a>0)this.z.width=a;if(b>0)this.z.height=b;this.a.push("2",a,b);this.b||this.c();this.d=0},C:function(a){var b=a.getContext("2d").e,c=r+":"+b;(a.width===0||a.height===0)&&i(11);if(b!==this.e&&(a=m[b].getContext("2d"),
|
||||
!a.d))b=++ba[b],c+=":"+b,a.a.push("3",b),a.b||a.c(),a.d=1;return c},k:function(a){var b=this.e,c=u[b],d=aa[b],e=c[a]=K[b]++;e>=da-1&&(K[b]=0);e in d&&delete c[d[e]];this.g.push(this.a.length+2);this.a.push("5",e,a);d[e]=a;return e}};o.prototype={addColorStop:function(a,b){(isNaN(a)||a<0||a>1)&&i(1);var c=this.J,d=this.id;(""+b).indexOf("%")>0&&c.i.push(c.a.length+3);c.a.push("y",d,a,b)}};O.prototype=Error();var ga={1:"INDEX_SIZE_ERR",9:"NOT_SUPPORTED_ERR",11:"INVALID_STATE_ERR",12:"SYNTAX_ERR",17:"TYPE_MISMATCH_ERR",
|
||||
18:"SECURITY_ERR"},C={initElement:function(a){if(a.getContext)return a;var b=Math.random().toString(36).slice(2)||"0",c="external"+b;s[b]=0;u[b]={};aa[b]=[];K[b]=0;p[b]=1;ba[b]=0;v[b]=[];$(a);a.innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+location.protocol+'//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="'+c+'"><param name="allowScriptAccess" value="always"><param name="flashvars" value="id='+c+
|
||||
'"><param name="wmode" value="transparent"></object><span style="margin:0;padding:0;border:0;display:inline-block;position:static;height:1em;overflow:visible;white-space:nowrap"></span>';m[b]=a;var d=a.firstChild;z[b]=a.lastChild;var e=k.body.contains;if(e(a))d.movie=t;else var f=setInterval(function(){if(e(a))clearInterval(f),d.movie=t},0);if(k.compatMode==="BackCompat"||!l.XMLHttpRequest)z[b].style.overflow="hidden";var h=new A(a,d);a.getContext=function(a){return a==="2d"?h:g};a.toDataURL=function(b,
|
||||
c){if(a.width===0||a.height===0)return"data:,";(""+b).replace(/[A-Z]+/g,ia)==="image/jpeg"?h.a.push("A",b,typeof c==="number"?c:""):h.a.push("A",b);return h.f().slice(1,-1)};d.attachEvent(U,Q);ca&&(d.attachEvent(F,D),a.attachEvent(G,E));N&&h.a.push(y,"usePolicyFile",N);b=h.a.length;h.g.push(b+2,b+5);h.a.push(y,"proxy",ea,y,"save",fa);return a},saveImage:function(a,b){a.firstChild.saveImage(b)},setOptions:function(a){for(var b in a){var c=a[b];switch(b){case "turbo":L=c;break;case "delay":M=c;break;
|
||||
case "disableContextMenu":ca=c;var d=void 0;for(d in m){var e=m[d],f=c?"attachEvent":"detachEvent";e.firstChild[f](F,D);e[f](G,E)}break;case "imageCacheSize":da=c;break;case "usePolicyFile":I(b,N=c?1:0);break;case "proxy":I(b,ea=c);break;case "save":I(b,fa=c)}}},trigger:function(a,b){m[a].fireEvent("on"+b)},unlock:function(a,b,c){var d,e,f;p[a]&&--p[a];if(b===q){d=m[a];b=d.firstChild;$(d);e=d.width;c=d.height;d.style.width=e+"px";d.style.height=c+"px";if(e>0)b.width=e;if(c>0)b.height=c;b.resize(e,
|
||||
c);d.attachEvent(V,R);s[a]=1;typeof d.onload==="function"&&setTimeout(function(){d.onload()},0)}else if(f=v[a][b])e=f[0],c=f[1+c],delete v[a][b],typeof c==="function"&&c.call(e)}};k.createElement(r);k.createStyleSheet().cssText=r+"{display:inline-block;overflow:hidden;width:300px;height:150px}";J&&(k.readyState==="complete"?B():k.attachEvent(P,B));l.attachEvent(T,S);t.indexOf(location.protocol+"//"+location.host+"/")===0&&(n=new ActiveXObject("Microsoft.XMLHTTP"),n.open("GET",t,!1),n.send(g));l[W]=
|
||||
A;l[X]=o;l[Y]=x;l[H]=C;l[Z]={init:function(){},init_:function(){},initElement:C.initElement}}(window,document);
|
||||
|
||||
|
||||
|
||||
(function(document){
|
||||
webshims.addReady(function(context, elem){
|
||||
if(context == document){
|
||||
if(window.G_vmlCanvasManager && G_vmlCanvasManager.init_ ){
|
||||
G_vmlCanvasManager.init_(document);
|
||||
}
|
||||
}
|
||||
webshims.$('canvas', context).add(elem.filter('canvas')).each(function(){
|
||||
var hasContext = this.getContext;
|
||||
if(!hasContext && window.G_vmlCanvasManager){
|
||||
G_vmlCanvasManager.initElement(this);
|
||||
}
|
||||
});
|
||||
});
|
||||
webshims.isReady('canvas', true);
|
||||
})(document);
|
94
public/webshims/shims/FlashCanvasPro/proxy.php
Normal file
94
public/webshims/shims/FlashCanvasPro/proxy.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy script to load a file from other domain
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* Copyright (c) 2010-2013 Shinya Muramatsu
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is< |