This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var handleUrlTabActivation = function () { | |
var hash = document.location.hash; | |
if(hash!=null && hash != ""){ | |
hash = hash.split('#')[1]; | |
} | |
console.log(hash); | |
var prefix = "tab-"; | |
var hpieces = hash.split('/'); | |
for (var i = 0; i < hpieces.length; i++) { | |
var domelid = hpieces[i].replace(prefix, ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FilterConfig | |
{ | |
public static void RegisterGlobalFilters(GlobalFilterCollection filters) | |
{ | |
filters.Add(new HandleErrorAttribute()); | |
filters.Add(new GlobalValidateAntiForgeryToken()); | |
//Instead of putting [ValidateAntiForgeryToken] Use this for all request | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.unseenrevolution.com/jquery-ajax-error-handling-function/ | |
$(function() { | |
$.ajaxSetup({ | |
error: function(jqXHR, exception) { | |
if (jqXHR.status === 0) { | |
alert('Not connect.\n Verify Network.'); | |
} else if (jqXHR.status == 404) { | |
alert('Requested page not found. [404]'); | |
} else if (jqXHR.status == 500) { | |
alert('Internal Server Error [500].'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return a CSV string from an array of json object | |
* | |
* @method JSONtoCSV | |
* @param {Object} jsonArray an array of json object | |
* @param {String} [delimiter=;] delimiter | |
* @param {String} [dateFormat=ISO] dateFormat if a date is detected | |
* @return {String} Returns the CSV string | |
**/ | |
function _JSONtoCSV(jsonArray, delimiter, dateFormat) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$.borwser plugin | |
//$.fileDownload plugin | |
downloadCsv: function (filename, array, dilem) { | |
var csvString = _JSONtoCSV(array, dilem); | |
console.log(csvString); | |
if ($.browser.msie == true) {//HTML5 Download attribute not available in ie | |
$.fileDownload('/downloadcsv', { httpMethod: "POST", data: { CsvString: csvString, FileName: filename} }); | |
} | |
else { | |
var a = document.createElement('a'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _generateUUID() { | |
var d = new Date().getTime(); | |
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |
var r = (d + Math.random() * 16) % 16 | 0; | |
d = Math.floor(d / 16); | |
return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16); | |
}); | |
return uuid; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JS Client For Websockets Server | |
//For C# Use Fleck & NetSockets | |
//https://github.com/statianzo/Fleck | |
//https://netsockets.codeplex.com/Wikipage?ProjectName=netsockets | |
var ws; | |
$(document).ready(function () { | |
// test if the browser supports web sockets | |
if ("WebSocket" in window) { | |
debug("Browser supports web sockets!", 'success'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.NET 4.0 | |
//Synchronous Controller: | |
public class TestController : Controller | |
{ | |
public ActionResult Index() | |
{ | |
return View(); | |
} | |
} |
OlderNewer