0
0
mirror of https://github.com/Doodle3D/doodle3d-connect.git synced 2024-11-05 07:03:24 +01:00
doodle3d-connect/js/JoinSecuredNetworkPage.js

60 lines
1.8 KiB
JavaScript
Raw Normal View History

2014-04-25 18:38:41 +02:00
/*
* This file is part of the Doodle3D project (http://doodle3d.com).
*
* Copyright (c) 2013, Doodle3D
* This software is licensed under the terms of the GNU GPL v2 or later.
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/
2014-05-12 14:44:21 +02:00
(function (w) {
2014-04-25 18:38:41 +02:00
var _page;
var _title;
var _form;
var _passwordField;
2014-05-08 00:07:24 +02:00
var _passwordCloneField;
2014-04-25 18:38:41 +02:00
var _submitButton;
var _pageData = {};
var PAGE_ID = "#join_secured_network";
var _self = this;
$.mobile.document.on( "pageinit", PAGE_ID, function( event, data ) {
console.log(PAGE_ID+" pageinit");
_page = $(this);
_title = _page.find("h3");
_form = _page.find("form");
_passwordField = _form.find("input[name=password]");
2014-05-08 23:41:02 +02:00
_passwordField.psswrd();
2014-05-08 00:07:24 +02:00
_passwordCloneField = _form.find("input[name=password-clone]");
_submitButton = _form.find("input[type=submit]");
2014-05-01 13:11:59 +02:00
_form.submit(join);
});
2014-04-25 18:38:41 +02:00
$.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) {
console.log(PAGE_ID+" pagebeforeshow");
_pageData = d3d.util.getPageParams(PAGE_ID);
if(_pageData === undefined) {
$.mobile.changePage("#boxes");
return;
}
2014-04-25 18:38:41 +02:00
console.log(" _pageData: ",_pageData);
_title.text("Join "+_pageData.ssid);
2014-05-01 13:11:59 +02:00
_form.attr("id","Join "+_pageData.ssid);
_passwordField.val("");
2014-05-08 00:07:24 +02:00
_passwordCloneField.val("");
2014-05-08 22:40:08 +02:00
});
$.mobile.document.on( "pageshow", PAGE_ID, function( event, data ) {
d3d.util.autofocus(_form);
2014-04-25 18:38:41 +02:00
});
2014-05-01 13:11:59 +02:00
function join(){
console.log("JoinSecuredNetworkPage:submit");
// ToDo: validation
// http://www.raymondcamden.com/index.cfm/2012/7/30/Example-of-form-validation-in-a-jQuery-Mobile-Application
if(_passwordField.val().length === 0) { return false; }
2014-05-01 13:11:59 +02:00
var submitLink = _form.data("target");
submitLink = d3d.util.replaceURLParameters(submitLink,_pageData);
$.mobile.changePage(submitLink);
return false;
}
2014-04-25 18:38:41 +02:00
})(window);