Skip to content

Instantly share code, notes, and snippets.

function getClipboard() {
if (window.clipboardData) {
// the IE-manier
return(window.clipboardData.getData('Text'));
// waarschijnlijk niet de beste manier om Moz/NS te detecteren;
// het is mij echter onbekend vanaf welke versie dit precies werkt:
} else if (window.netscape) {
/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: [email protected]
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.7a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
*
* Example usage:
* DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
function createSheet(){
var style = new Element('style').inject(document.head);
return style.styleSheet||style.sheet;
}
//http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20233392.html
function CopyPlusSelect(FData) {
var dataVal = eval('document.'+FData);
dataVal.focus();
dataVal.select();
var copyText = dataVal.value;
if (window.clipboardData) { // IE send-to-clipboard method.
window.clipboardData.setData('Text', copyText);
} else if (window.netscape) {
var StyleSheet=new Class({
initialize: function(){
this.createSheet();
this.rules={};
this.styles={};
this.index=[];
},
createSheet: function(){
function initVml(){
if(!Browser.Engine.trident) return;
document.namespaces.add('v', 'urn:schemas-microsoft-com:vml');
vmlSheet=new StyleSheet().addRule('v\\:*', 'behavior:url(#default#VML)');
}
initVml();
var rect=new Element('v:rect',{
styles:{
width: 100,
height: 100,
function vmlImage(props){
var left=(props.left||0)-1;
var top=(props.top||0)-1;
var width=props.width+1;
var height=props.height+1;
var rect=new Element('v:rect',{
styles:{
width: width,
height: height,
left: left,
// http://habrahabr.ru/blogs/svg/37595/
SVG = {
_NS: 'http://www.w3.org/2000/svg',
_regexp: {
istext: /text|tspan|tref/i,
translate: /translate\(([-\d\.]+),?\s*([-\d\.]*?)\)/i,
rotate: /rotate\(([\d\.]+),?.*?\)/i,
scale: /scale\(([\d\.]+),?.*?\)/i
},
var SVG={
ns: 'http://www.w3.org/2000/svg'
}
var svg = document.createElementNS(SVG.ns, 'svg').inject(document.body);
svg.setAttribute('width',100);
svg.setAttribute('height',100);
svg.setStyles({
position: 'absolute',
left:10,
top:10
XML.getNodes=function(node, xpath){
var found=[], foundNodes;
var root=node.ownerDocument||node;
if(Browser.Engine.trident){
root.setProperty("SelectionLanguage","XPath");
foundNodes=node.selectNodes(xpath)
for(var i=0, l=foundNodes.length; i<l; i++) found.push(foundNodes[i]);
}else{
foundNodes=root.evaluate(xpath, node, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i=0, l=foundNodes.snapshotLength; i<l; i++) found.push(foundNodes.snapshotItem(i));