Here’s a NoScript element
Here’s a GistHub snippet:
..and here’s some stuff afterwards:
- Item1
- Item2
- Item3
..editing this post:
- l1
- l2
- l3
Here’s a NoScript element
Here’s a GistHub snippet:
..and here’s some stuff afterwards:
..editing this post:
User agent is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
namespace COB.SharePointAutohostedAppWeb.Pages
{
public partial class SearchResults : System.Web.UI.Page
{
SharePointContextToken contextToken;
string accessToken;
Uri sharepointHostWebUrl;
protected void Page_Load(object sender, EventArgs e)
{
string queryText = "timesheets";
TokenHelper.TrustAllCertificates();
string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);
if (contextTokenString != null)
{
// get context token from TokenHelper..
contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);
// use it to get the access token..
sharepointHostWebUrl = new Uri(Request.QueryString["SPHostUrl"]);
accessToken = TokenHelper.GetAccessToken(contextToken, sharepointHostWebUrl.Authority).AccessToken;
// pass the access token - N.B. if this was a control event (rather than page load), we'd need to persist
// this somewhere it could be accessed in the event handler..
runSearch(accessToken, queryText);
}
}
private void runSearch(string accessToken, string queryText)
{
if (IsPostBack)
{
sharepointHostWebUrl = new Uri(Request.QueryString["SPHostUrl"]);
}
string searchRestUrl = string.Format("/_api/search/query?querytext='{0}'", queryText);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(sharepointHostWebUrl.ToString() + searchRestUrl);
request.Method = "GET";
request.Accept = "application/atom+xml";
request.ContentType = "application/atom+xml;type=entry";
request.Headers.Add("Authorization", "Bearer " + accessToken);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// process response..
XDocument oDataXML = XDocument.Load(response.GetResponseStream(), LoadOptions.None);
XNamespace atom = "http://www.w3.org/2005/Atom";
XNamespace d = "http://schemas.microsoft.com/ado/2007/08/dataservices";
XNamespace m = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
Listitems = oDataXML.Descendants(d + "query")
.Elements(d + "PrimaryQueryResult")
.Elements(d + "RelevantResults")
.Elements(d + "Table")
.Elements(d + "Rows")
.Elements(d + "element")
.ToList();
// N.B. there might be a more elegant/efficient way of extracting the values from the (slightly awkward) XML than this..
var searchResults = from item in items
select new
{
Title = item.Element(d + "Cells").Descendants(d + "Key").First(a => a.Value == "Title").Parent.Element(d + "Value").Value,
Author = item.Element(d + "Cells").Descendants(d + "Key").First(a => a.Value == "Author").Parent.Element(d + "Value").Value,
HitHighlightedSummary = item.Element(d + "Cells").Descendants(d + "Key").First(a => a.Value == "HitHighlightedSummary").Parent.Element(d + "Value").Value,
Path = item.Element(d + "Cells").Descendants(d + "Key").First(a => a.Value == "Path").Parent.Element(d + "Value").Value
};
// data-bind to ListView..
lvSearchResults.DataSource = searchResults;
lvSearchResults.DataBind();
}
}
}
function helloSyntaxHighlighter()
{
Window.chrisob = Window.chrisob || {};
$(document).ready(function () {
$('#testPara').css('color', 'red');
chrisob.BlogFixer.FixLineBreaksInCodeBlocks();
});
chrisob.BlogFixer = {
FixLineBreaksInCodeBlocks: function () {
$('#pre.brush: js').css('color', 'red');
$('pre.brush: js').html().replace("
", "replaced");
}
}
}
Editing the post to put something at the end
Some text before GistHub sample..
Some text after
Some text before SH sample..
Window.chrisob = Window.chrisob || {};
$(document).ready(function () {
$('#testPara').css('color', 'red');
chrisob.BlogFixer.FixLineBreaksInCodeBlocks();
});
chrisob.BlogFixer = {
FixLineBreaksInCodeBlocks: function () {
$('#pre.brush: js').css('color', 'red');
$('pre.brush: js').html().replace("<br>", "replaced");
}
}
Some text after
Editing the post to put something at the end
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur