Skip to content

Instantly share code, notes, and snippets.

some one hammadbinarif

Block or report user

Report or block hammadbinarif

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DeleteProjectSites.js
var script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
function retrieveData(url) {
var dfd = jQuery.Deferred();
console.log('Data url is + ' + url)
jQuery.ajax({url:url,
type: "GET",
dataType: "json",
headers: {Accept: "application/json;odata=verbose" }
View PDPFieldWriter.ts
import {PDPFieldReader} from 'PDPFieldReader'
export class PDPFieldWriter {
static set_FormFieldValue = (fieldName: string, value: string) => {
var inputField = $('Input[Title="' + fieldName + '"]');
if (inputField.length == 0) {
console.warn("Couldn't find form field " + fieldName);
return "";
View PDPFieldReader.ts
export class PDPFieldReader {
static get_FormFieldValue_Number = (fieldName: string, editMode: boolean): number => {
return Number(PDPFieldReader.get_FormFieldValue_Text(fieldName,editMode).replace(/[^0-9\.]+/g, ""));
}
static get_FormFieldValue_Date = (fieldName: string, editMode: boolean): Date => {
var textValue = PDPFieldReader.get_FormFieldValue_Text(fieldName, editMode);
// parsing for UK dd/mm/yyyy
View console proxy
window.console = window.console || (function(){
var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile = c.clear = c.exception = c.trace = c.assert = function(){};
return c;
})();
View pdpEditmode.js
_spBodyOnLoadFunctionNames.push("myScriptStartup");
function myScriptStartup () {
var editMode = EditState.Editing;
if (editMode) {
// PDP is in edit mode
// Do things differently here
console.log('PDP is in edit mode. so our input fields will be editable');
}
else {
View pageeditmode.js
_spBodyOnLoadFunctionNames.push("myScriptStartup");
function myScriptStartup () {
var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
if (inDesignMode == "1") {
// page is in edit mode
// Do things differently here
console.log('Page is in edit mode. so we will not execute the custom script');
}
else {
You can’t perform that action at this time.