ensure non url chars are not used for pad names or pad links
parent
e56ef9c26e
commit
b43c7e7c99
|
@ -20,6 +20,15 @@ var socket;
|
||||||
|
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
|
//test if the url is proper, means without any ? or # that doesn't belong to a url
|
||||||
|
//if it isn't proper, clean the url a do a redirect
|
||||||
|
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
|
||||||
|
var expectedURL = document.location.href.substring(0,document.location.href.lastIndexOf("/") ) + "/" + padId;
|
||||||
|
if(expectedURL != document.location.href)
|
||||||
|
{
|
||||||
|
document.location = expectedURL;
|
||||||
|
}
|
||||||
|
|
||||||
handshake();
|
handshake();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -82,8 +91,8 @@ function handshake()
|
||||||
|
|
||||||
socket.once('connect', function()
|
socket.once('connect', function()
|
||||||
{
|
{
|
||||||
var padId = document.URL.substring(document.URL.lastIndexOf("/") + 1);
|
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
document.title = document.title + " | " + padId;
|
document.title = document.title + " | " + padId;
|
||||||
|
|
||||||
var token = readCookie("token");
|
var token = readCookie("token");
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
$(window).load(function ()
|
$(window).load(function ()
|
||||||
{
|
{
|
||||||
//get the padId out of the url
|
//get the padId out of the url
|
||||||
var urlParts= document.URL.split("/");
|
var urlParts= document.pathname.split("/");
|
||||||
padId = urlParts[urlParts.length-2];
|
padId = urlParts[urlParts.length-2];
|
||||||
|
|
||||||
//set the title
|
//set the title
|
||||||
|
|
Loading…
Reference in New Issue