Enhance my client code
-
Hello; Can you please tell me how can I enhance my client side code of a sharepoint 2010 webpart project? I'm using the code optimizer and beautifier 'Resharper', it does not suggest any refactoring or change on my code. My application contains a single html page. Note that there is no head or body subdivision on purpose because the container (of the webpart) sharepoint page already contains that. I did not externalize the javascript into an external folder because there is so few javascript lines that I decided it is not worth it to create a special folder just to put 1 little script in it. Thanks, Teycir. Here's the code:
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="VisualWebPart1UserControl.ascx.cs" Inherits="AD_RW.VisualWebPart1.VisualWebPart1UserControl" %>function GetMyfare() { var readerName = GetReader(); var set = document.IDactisPCSC.setActiveReader(readerName); RefreshCardSerial(); } function GetReader() { var reader; var nb = document.IDactisPCSC.getReaderCount(); var i; for (i = 0; i < nb; i++) { if (document.IDactisPCSC.getReaderName(i).search( /contactless/i ) != -1) { reader = document.IDactisPCSC.getReaderName(i); } } return reader; } function RefreshCardSerial() { document.getElementById('PCSCCardSerial').innerHTML = document.IDactisPCSC.getCardSerial(); } // In order to fire from onload event within sharepoint webpart \_spBodyOnLoadFunctionNames.push("GetMyfare");
<%--Css externalisée sur le dossier UI--%>
-
Hello; Can you please tell me how can I enhance my client side code of a sharepoint 2010 webpart project? I'm using the code optimizer and beautifier 'Resharper', it does not suggest any refactoring or change on my code. My application contains a single html page. Note that there is no head or body subdivision on purpose because the container (of the webpart) sharepoint page already contains that. I did not externalize the javascript into an external folder because there is so few javascript lines that I decided it is not worth it to create a special folder just to put 1 little script in it. Thanks, Teycir. Here's the code:
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="VisualWebPart1UserControl.ascx.cs" Inherits="AD_RW.VisualWebPart1.VisualWebPart1UserControl" %>function GetMyfare() { var readerName = GetReader(); var set = document.IDactisPCSC.setActiveReader(readerName); RefreshCardSerial(); } function GetReader() { var reader; var nb = document.IDactisPCSC.getReaderCount(); var i; for (i = 0; i < nb; i++) { if (document.IDactisPCSC.getReaderName(i).search( /contactless/i ) != -1) { reader = document.IDactisPCSC.getReaderName(i); } } return reader; } function RefreshCardSerial() { document.getElementById('PCSCCardSerial').innerHTML = document.IDactisPCSC.getCardSerial(); } // In order to fire from onload event within sharepoint webpart \_spBodyOnLoadFunctionNames.push("GetMyfare");
<%--Css externalisée sur le dossier UI--%>