Commit d66c3542629af969a56fd56d3c4552bb35364015

Authored by Leandro Santos
1 parent e152b3a2

refactoring fullscreen url parameter activation

Showing 1 changed file with 5 additions and 12 deletions   Show diff stats
public/javascripts/application.js
... ... @@ -1166,16 +1166,9 @@ function add_new_file_fields() {
1166 1166  
1167 1167 window.isHidden = function isHidden() { return (typeof(document.hidden) != 'undefined') ? document.hidden : !document.hasFocus() };
1168 1168  
1169   -function getQueryParams(qs) {
1170   - qs = qs.split("+").join(" ");
1171   - var params = {},
1172   - tokens,
1173   - re = /[?&]?([^=]+)=([^&]*)/g;
1174   - while (tokens = re.exec(qs)) {
1175   - params[decodeURIComponent(tokens[1])]
1176   - = decodeURIComponent(tokens[2]);
1177   - }
1178   - return params;
  1169 +function $_GET(id){
  1170 + var a = new RegExp(id+"=([^&#=]*)");
  1171 + return decodeURIComponent(a.exec(window.location.search)[1]);
1179 1172 }
1180 1173  
1181 1174 var fullwidth=false;
... ... @@ -1197,8 +1190,8 @@ function toggle_fullwidth(itemId){
1197 1190  
1198 1191 function fullscreenPageLoad(itemId){
1199 1192 jQuery(document).ready(function(){
1200   - var $_GET = getQueryParams(document.location.search);
1201   - if ($_GET['fullscreen']==1){
  1193 +
  1194 + if ($_GET('fullscreen') == 1){
1202 1195 toggle_fullwidth(itemId);
1203 1196 }
1204 1197 });
... ...