Move JS to main.js

This commit is contained in:
Chris Wiggins 2013-09-19 21:10:41 +12:00
parent 133b061179
commit a49e66889d
2 changed files with 12 additions and 13 deletions

View File

@ -28,15 +28,3 @@
$this->Js->get('#monitors');
$this->Js->sortable(array('complete' => '$.post("/monitors/reorder", $("#monitors").sortable("serialize"))',));
?>
<script type="text/javascript">
$(window).load(function () {
$(".livestream_resize").each(function(index, element){
if($(element).attr('src').indexOf('scale=') >= 0){
var newScale = Math.ceil(($(element).width() / $(element).attr('width')) * 100);
var src = $(element).attr('src').replace('scale=100', 'scale='+newScale);
$(element).attr('src', src);
}
});
});
</script>

11
web/app/webroot/js/main.js Normal file → Executable file
View File

@ -193,6 +193,17 @@ $(document).ready(function() {
}
});
});
$(".livestream_resize").each(function(index, element){
if($(element).attr('src').indexOf('scale=') >= 0){
var newScale = Math.ceil(($(element).width() / $(element).attr('width')) * 100);
var src = $(element).attr('src').replace('scale=100', 'scale='+newScale);
$(element).attr('src', src);
console.log("resized");
}
});
return false;
// Monitors //