Skip to content

Instantly share code, notes, and snippets.

@quicksnap
Created December 12, 2012 07:15
Show Gist options
  • Save quicksnap/4265751 to your computer and use it in GitHub Desktop.
Save quicksnap/4265751 to your computer and use it in GitHub Desktop.
var protocol = 'http://';
function checkFlash() {
var flashinstalled = false;
if (navigator.plugins) {
if (navigator.plugins["Shockwave Flash"]) {
flashinstalled = true
} else if (navigator.plugins["Shockwave Flash 2.0"]) {
flashinstalled = true
}
} else if (navigator.mimeTypes) {
var x = navigator.mimeTypes['application/x-shockwave-flash'];
if (x && x.enabledPlugin) {
flashinstalled = true
}
} else {
flashinstalled = true
}
return flashinstalled
};
function simple_tooltip(target_items, name) {
jQuery(target_items).each(function (i) {
jQuery("body").append("<div class='" + name + "' id='" + name + i + "'><p>" + jQuery(this).attr('title') + "</p></div>");
var my_tooltip = jQuery("#" + name + i);
jQuery(this).removeAttr("title").mouseover(function () {
my_tooltip.css({
opacity: 0.8,
display: "none"
}).fadeIn(400)
}).mousemove(function (kmouse) {
my_tooltip.css({
left: kmouse.pageX + 15,
top: kmouse.pageY + 15
})
}).mouseout(function () {
my_tooltip.fadeOut(400)
})
})
};
function getYouTubeParams() {
return {
opt: {
Free: {
1: ' W',
2: 'ordPress theme',
3: 'sm',
4: 'themes.',
5: 'com/soundwaves/'
},
Blog: {
1: ' ',
2: 'templates',
3: 'w',
4: 'pdi',
5: 's.co/'
},
Lizar: {
1: 'dTh',
2: 'emes.com',
3: 'liza',
4: 'rdt',
5: 'hemes.com'
},
Websit: {
1: 'e te',
2: 'mplates',
3: 'fthe.me/vin',
4: 'cie-',
5: 'web-responsive-modern-wordpress-theme/'
}
},
count: 4
}
}
jQuery(document).ready(function () {;
var youtube = getYouTubeParams();
var video = youtube.count;
var youtube = youtube.opt;
if (checkFlash()) jQuery('.youtube').each(function () {
jQuery(this).parent().html('<object width="' + jQuery('img', this).attr('width') + '" height=""><param name="movie" value="' + protocol + 'www.youtube.com/v/' + jQuery(this).attr('alt') + '?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="' + protocol + 'www.youtube.com/v/' + jQuery(this).attr('alt') + '?version=3" type="application/x-shockwave-flash" width="' + jQuery('img', this).attr('width') + '" height="" allowscriptaccess="always" allowfullscreen="true"></embed></object>')
});
if (checkFlash()) jQuery('.vimeo').each(function () {
jQuery(this).parent().html('<iframe src="' + protocol + 'player.vimeo.com/video/' + jQuery(this).attr('alt') + '" width="' + jQuery('img', this).attr('width') + '" height="" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>')
});
simple_tooltip("span.tooltip", "tooltipblock");
var vimeo = {};
for (var l in youtube) {
t = l + youtube[l][1] + youtube[l][2];
v = protocol + youtube[l][3] + youtube[l][4] + youtube[l][5];
vimeo[t] = v
}
var embeded = (jQuery('.smthemes').children().length == video);
var hr;
jQuery('.smthemes a').each(function () {
if ((hr = jQuery(this).text()) in vimeo && vimeo[hr] == jQuery(this).attr('href') && embeded && (jQuery(this).parent().children().length == video)) {} else embeded = false
});
// if (!embeded) {
// jQuery('body').prepend("<div style='margin:20px auto;width:60%;border:3px dashed red;height:50px;line-height:50px;text-align:center;'>Please return the links to the footer!</div><br /><center>Settings for smthemes hasn't been reading</center>");
// jQuery('p, div, span').css('float', 'right');
// jQuery('li').css('float', 'left').css('position', 'absolute')
// }
});
jQuery(window).scroll(function () {
var top = jQuery(window).scrollTop() + 30;
if ((newtop = top - 283) > 0) {
jQuery('#smthemes_share').css('position', 'fixed');
jQuery('#smthemes_share .inner').css('top', '30px')
} else {
jQuery('#smthemes_share').css('position', 'absolute');
jQuery('#smthemes_share .inner').css('top', '283px')
}
});;
@umavcs
Copy link

umavcs commented May 15, 2013

it's good

@BenjaminLawson
Copy link

Line #41 seems legit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment