Comments (1)
JavaScript
this is from forkphorus embed.js
// NOTE: embed.js is deprecated and only exists for compatibility reasons.
// Please use a direct <iframe> of embed.html instead!
(function() {
'use strict';
// compatibility: embed.js does not work in some common WYSIWYG editors
// security: this script could potentially do things like steal browser cookies. an <iframe> should not be able to do this ("same origin policy")
// embed.js won't be removed soon but it may be removed "eventually" and is not actively tested
console.warn('forkphorus: embed.js is deprecated due to compatibility and security concerns and may stop working in the future. Please use a direct <iframe> of embed.html instead! The generator on https://forkphorus.github.io/ has been updated to do this.');
// Get this script's HTML element.
// We'll replace the script element with the frame.
var script = document.currentScript || (function(scripts) {
return scripts[scripts.length - 1];
})(document.getElementsByTagName('script'));
// Determine the hasUI option to properly size the frame.
var hasUI = true;
var baseWidth = 480;
var baseHeight = 360;
var params = script.src.split('?')[1].split('&');
params.forEach(function(p) {
var parts = p.split('=');
switch (parts[0]) {
case 'ui':
hasUI = parts[1] !== 'false';
break;
case 'w':
baseWidth = +parts[1];
break;
case 'h':
baseHeight = +parts[1];
break;
}
});
var iframe = document.createElement('iframe');
iframe.setAttribute('allowfullscreen', true);
iframe.setAttribute('allowtransparency', true);
iframe.src = script.src.replace('embed.js', 'embed.html');
if (hasUI) {
// include enough for controls and the player border
iframe.width = baseWidth + 2;
iframe.height = baseHeight + 33;
} else {
iframe.width = baseWidth;
iframe.height = baseHeight;
}
iframe.style.border = '0';
iframe.className = 'forkphorus-embed';
script.parentNode.replaceChild(iframe, script);
}());
from test.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from test.