Commit 1294cc9cf71cb4e2afc9d0c5571d0c457d3f2151
1 parent
7fd8b02b
Exists in
staging
and in
4 other branches
Fix merge with AI3160-fullscreen_for_article
Showing
1 changed file
with
37 additions
and
0 deletions
Show diff stats
public/javascripts/application.js
... | ... | @@ -1075,3 +1075,40 @@ function apply_zoom_to_images(zoom_text) { |
1075 | 1075 | }); |
1076 | 1076 | }); |
1077 | 1077 | } |
1078 | + | |
1079 | +function getQueryParams(qs) { | |
1080 | + qs = qs.split("+").join(" "); | |
1081 | + var params = {}, | |
1082 | + tokens, | |
1083 | + re = /[?&]?([^=]+)=([^&]*)/g; | |
1084 | + while (tokens = re.exec(qs)) { | |
1085 | + params[decodeURIComponent(tokens[1])] | |
1086 | + = decodeURIComponent(tokens[2]); | |
1087 | + } | |
1088 | + return params; | |
1089 | +} | |
1090 | + | |
1091 | +var fullwidth=false; | |
1092 | +function toggle_fullwidth(itemId){ | |
1093 | + if(fullwidth){ | |
1094 | + jQuery(itemId).removeClass("fullwidth"); | |
1095 | + jQuery("#fullscreen-btn").show() | |
1096 | + jQuery("#exit-fullscreen-btn").hide() | |
1097 | + fullwidth = false; | |
1098 | + } | |
1099 | + else{ | |
1100 | + jQuery(itemId).addClass("fullwidth"); | |
1101 | + jQuery("#exit-fullscreen-btn").show() | |
1102 | + jQuery("#fullscreen-btn").hide() | |
1103 | + fullwidth = true; | |
1104 | + } | |
1105 | +} | |
1106 | + | |
1107 | +function fullscreenPageLoad(itemId){ | |
1108 | + jQuery(document).ready(function(){ | |
1109 | + var $_GET = getQueryParams(document.location.search); | |
1110 | + if ($_GET['fullscreen']==1){ | |
1111 | + toggle_fullwidth(itemId); | |
1112 | + } | |
1113 | + }); | |
1114 | +} | ... | ... |