Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force type of link in settings #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add support fo forcing type of link in settings
  • Loading branch information
shagi committed Nov 8, 2012
commit 16fc49e28312437bc4a05c109f5b31d503fc5686
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ <h2>Custom content</h2>
<li><a href="#?custom=true&width=260&height=270" rel="prettyPhoto">Google Maps</a></li>
<li><a href="#?custom=true&width=260&height=400" rel="prettyPhoto">Ads</a></li>
</ul>

<h2>Force link type</h2>
<ul id="forcetype_content" class="gallery clearfix">
<li><a href="#?width=260&height=270" rel="prettyPhoto">Google Maps</a></li>
</ul>

<br /><br />

Expand All @@ -195,6 +200,13 @@ <h2>Custom content</h2>
custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
changepicturecallback: function(){ _bsap.exec(); }
});

$("#forcetype_content a[rel^='prettyPhoto']").prettyPhoto({
type: 'custom',
custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
changepicturecallback: function(){ initialize(); }
});

});
</script>

Expand Down
5 changes: 4 additions & 1 deletion js/jquery.prettyPhoto.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$.fn.prettyPhoto = function(pp_settings) {
pp_settings = jQuery.extend({
hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
type: 'auto', /* Force link type. Leave 'auto' for auto detection or set to one of 'youtube', 'vimeo', 'quicktime', 'flash', 'iframe', 'ajax', 'custom', 'inline', 'image' */
animation_speed: 'fast', /* fast/slow/normal */
ajaxcallback: function() {},
slideshow: 5000, /* false OR interval time in ms */
Expand Down Expand Up @@ -657,7 +658,9 @@
}

function _getFileType(itemSrc){
if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
if (settings.type != 'auto') {
return settings.type;
}else if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
return 'youtube';
}else if (itemSrc.match(/vimeo\.com/i)) {
return 'vimeo';
Expand Down