Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Enhance my client code

Enhance my client code

Scheduled Pinned Locked Moved SharePoint
questioncsharpjavascripthtmlcss
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    teycir
    wrote on last edited by
    #1

    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--%>

    S 1 Reply Last reply
    0
    • T teycir

      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--%>

      S Offline
      S Offline
      ssivarao
      wrote on last edited by
      #2

      copy/paste the script in Content Editor WebPart in SharePoint 2010 . Remove the html tag and body tag in Cotent Editor WebPart

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups