ReferenceError: documentGetElementsByName is not defined
MoveSiteTitle();
ReferenceError: MoveSiteTitle is not defined
MoveSiteTitle();
Any help ....!
Well, seems to be a Chrome related issue as df1 reported. There is one solution however to get rid of the script error if you like.
Put this code inside your master page above the s4-workspace tag or similar:
if(typeof documentGetElementsByName==='undefined')
{
documentGetElementsByName = function(value){
if($('[name="'+value+'"]'))
{
return $('[name="'+value+'"]');
}
return null;
};
}
if(typeof MoveSiteTitle==='undefined')
{
// Well.... Don't know what this function is supposed to do
// but this way I am avoiding script error...
MoveSiteTitle = function(value){
return "";
};
}
This is just javascript basic error.Here documentGetElementsByName(What is the variable name here) Check this variable name and search cant find any where in ur current page. Modify variable name or put some condition over there.
The problem is that something in your configuration is causing the script that contains the method MoveSiteTitle() to not load.
I was able to obtain the source for the method "MoveSiteTitle" from my dev tools console. You could alter your master page to include the following JavaScript in the <head> section of the master page.
if (typeof MoveSiteTitle === 'undefined') {
function MoveSiteTitle() {
a:;
var b = documentGetElementsByName("titlewpTitleArea");
if (b == null || b[0] == null) return;
var a = b[0],
c = documentGetElementsByName("onetidProjectPropertyTitle");
if (c == null || c[0] == null) return;
var e = c[0],
d = document.getElementById("onetidPageTitleSeparator");
if (d == null) return;
if (Boolean(a.insertAdjacentElement)) {
a.insertAdjacentElement("afterBegin", d);
a.insertAdjacentElement("afterBegin", e)
} else {
a.insertBefore(d, a.firstChild);
a.insertBefore(e, a.firstChild)
}
}
}
Also, I found the MoveSiteTitle method (for Sharepoint 2013) in the following file within the hive (hive 15).
V:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\IE55UP.js
You might be able to debug your specific configuration from there.
Also, the script for GetElementsByName is...
function GetElementsByName(b) {
var a = document.getElementsByName(b);
if (a.length == 0 && Boolean(window.XMLHttpRequest)) a = FFGetElementsById(document, b);
return a
}
Related
Okay so, I npm run build my application, drag the build files into tizon studio.
Run the application...
I get the error:
2.bd938b3f.chunk.js:79798 Uncaught TypeError: Object.values is not a function
The same behavior is shown on any Samsung and Tizon model I've tested this on.
I've tried switching out Object.values with Object.map,
which returns "the same" error.
2.bd938b3f.chunk.js:79798 Uncaught TypeError: Object.map is not a function
I have not been able to find an answer to fix this.
Any help with finding an answer would be massively appreciated.
Thank you all in advance!
if (!le) {
(function () {
for (var e = window.document.getElementsByTagName("script"), t = 0, n = Object.values(e); t < n.length; t++) {
var r = n[t];
if (r.src && r.src.includes(te))
return r
}
return null
})() || function (e) {
var t = document.createElement("script");
t.src = te + "?l=" + e,
t.async = !0,
document.head.appendChild(t)
}
(ue),
function (e) {
var t = [];
Array.isArray(window[e]) ? t = window[e] : window[e] = t
}
(ue);
var r = ne(se, ue, ce),
i = r.wrappedGtag,
a = r.gtagCore;
ie = i,
re = a,
le = !0
}
Samsung's TizenOS's javascript isn't as up-to-date as it could be, and according to this looks to not be actively supported.
You can use react-app-polyfill to provide any missing functionalities.
We use the following in our root index.jsx as the "kitchen sink" of polyfills
import 'react-app-polyfill/ie9';
import 'react-app-polyfill/stable';
It seems Object.values() is not supported in your developing environment. Try adding this polyfill on top of your script file: https://github.com/tc39/proposal-object-values-entries/blob/master/polyfill.js
You can define your own values function if the node version is too low.
if (!Object.values) {
Object.values = function values(O) {
return Object.keys(O).map(k=>O[k]);
};
}
I need to access per-machine configuration data in my Node application running on Windows. I've found this documentation for how to find the location:
Where Should I Store my Data and Configuration Files if I Target Multiple OS Versions?
So, in my case, I would like to get the path for CSIDL_COMMON_APPDATA (or FOLDERID_ProgramData). However, the examples are all in C, and I would prefer to not have to write a C extension for this.
Is there any other way to access these paths from Node, or should I just hardcode them?
After doing a bit of research, I've found that it's possible to call the relevant Windows API proc. (SHGetKnownFolderPath) to get these folder locations, see docs at: https://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx.
We call the APi using the FFI npm module: https://www.npmjs.com/package/ffi.
It is possible to find the GUIDs for any known folder here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx
Here is a script that finds the location of several common folders,
some of the code is a little hacky, but is easily cleaned up.
const ffi = require('ffi');
const ref = require('ref');
const shell32 = new ffi.Library('Shell32', {
SHGetKnownFolderPath: ['int', [ ref.refType('void'), 'int', ref.refType('void'), ref.refType(ref.refType("char"))]]
});
function parseGUID(guidStr) {
var fields = guidStr.split('-');
var a1 = [];
for(var i = 0; i < fields.length; i++) {
var a2 = [...Buffer.from(fields[i], 'hex')];
if (i < 3) a2 = a2.reverse();
a1 = a1.concat(a2);
}
return new Buffer(a1);
}
function getWindowsKnownFolderPath(pathGUID) {
let guidPtr = parseGUID(pathGUID);
guidPtr.type = ref.types.void;
let pathPtr = ref.alloc(ref.refType(ref.refType("void")));
let status = shell32.SHGetKnownFolderPath(guidPtr, 0, ref.NULL, pathPtr);
if (status !== 0) {
return "Error occurred getting path: " + status;
}
let pathStr = ref.readPointer(pathPtr, 0, 200);
return pathStr.toString('ucs2').substring(0, (pathStr.indexOf('\0\0') + 1)/2);
}
// See this link for a complete list: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx
const WindowsKnownFolders = {
ProgramData: "62AB5D82-FDC1-4DC3-A9DD-070D1D495D97",
Windows: "F38BF404-1D43-42F2-9305-67DE0B28FC23",
ProgramFiles: "905E63B6-C1BF-494E-B29C-65B732D3D21A",
Documents: "FDD39AD0-238F-46AF-ADB4-6C85480369C7"
}
// Enumerate common folders.
for(let [k,v] of Object.entries(WindowsKnownFolders)) {
console.log(`${k}: `, getWindowsKnownFolderPath(v));
}
I have virtual server where is configured IIS 7.5 to works with ASP.NET MVC.
When I deploy application everything works fine. Only one thing is not working when I run application, maybe I'm wrong but I thought that code is correct.
<script>
$(document).ready(function () {
$("#Subcode").prop("disabled", true);
$("#MasterId").change(function () {
if ($("#MasterId").val() != "Select Master Code") {
var CountryOptions = {};
CountryOptions.url = "/Audit/FindSubCode";
CountryOptions.type = "POST";
CountryOptions.data = JSON.stringify({ master_id: $("#MasterId").val() });
CountryOptions.datatype = "json";
CountryOptions.contentType = "application/json";
CountryOptions.success = function (SubCodeList) {
$("#Subcode").empty();
for (var i = 0; i < SubCodeList.length; i++) {
$("#Subcode").append("<option>" + SubCodeList[i] + "</option>");
}
$("#Subcode").prop("disabled", false);
};
CountryOptions.error = function () { alert("Error in Getting SubCodes!!"); };
$.ajax(CountryOptions);
}
else {
$("#Subcode").empty();
$("#Subcode").prop("disabled", true);
}
});
});
</script>
#Html.DropDownList("MasterId",ViewBag.MasterId as SelectList,"Select Master Code",new { #class = "form-control"})
<select id="Subcode"></select>
And code from controller
public JsonResult FindSubCode(int master_id)
{
List<string> SubCodeList = new List<string>();
switch(master_id)
{
case 1:
SubCodeList.Add("Test");
break;
case 2:
SubCodeList.Add("Test2");
break;
}
return Json(SubCodeList);
}
Why I'm writing this problem as IIS Configuration, because if I run locally this application, everything works fine. But when I run on server I got error from code "Error in Getting SubCodes!!".
I tried to debug and get next error: Error when devug
Any suggestion how I can fix this ?
I don't think it has to do with configuration. Verify your URL.
/Audit/FindSubCode would be pointing to the root of the server which may be a different path to where the application is being served from.
Try not to hard code the path but rather use razor engin UrlHelper to generate the path.
CountryOptions.url = "#(Url.Action("FindSubCode","Audit")";
I want to write some command with some args (for example /add 5 5 and it will print 10) in console when program is already running. How should I do it?
How to read from console is already explained in this answer, so I'll just show you how to parse those lines.
Example approach is to create object with references to your functions, and then call them by name, after parsing input string.
My example uses Spread Operator and let which need running script in strict mode ( "use strict"; ).
Example's code:
"use strict";
var funs = {};
funs.add = function add (x, y) {
if( x === undefined || y === undefined ) {
console.log("Not enough arguments for add!");
return;
}
console.log("Result:", (+x) + (+y));
}
function parseInput(input) {
if( input.charAt(0) === "/" ) {
let tmp = input.substring(1);
tmp = tmp.split(" ");
let command = tmp[0];
let args = tmp.slice(1);
let fun = funs[command];
if ( fun === undefined ) {
console.log(command, "command is not defined!");
return;
}
fun(...args);
}
}
parseInput("/add 5 6");
The following npm packages could help you a lot, and their docs are very great to start with:
https://www.npmjs.com/package/comman
https://www.npmjs.com/package/prompt
I'm writing a plugin for Brunch to 'filter' files from code library. Basic idea is to:
check my source files (in src\ folder, or any watched folders that don't match library pattern),
build a list of imported/required modules from code library (in lib\ folder, outside src\, somewhere on disk)
check files against this list and 'approve' or 'reject' them
compile only what's 'approved', so I don't end up with huge files that have all modules/components from my library, but only what I use in particular project
When I work only with JavaScript files this.pattern = /.*(js|jsx)$/; everything works fine. Next step is to include more files, since many modules/components in library have some sort of template or stylesheets, for example this is one AngularJS module:
lib\
modules\
pager\
controller.jsx
directive.jsx
template.html
pager.styl
README.md
But when I expand the pattern to include other files this.pattern = /.*/;, I run into all sorts of issues (; Most have to do with pipline - those are the kinds of errors I'm getting. For example:
jshint-brunch doesn't like README.md
html-brunch won't wrap template.html
stylus-brunch and sass-brunch are also unhappy
I've tried solving these problems individually, for example if I disable html-brunch config.plugins.off: ['html-brunch'], and add this code inside the compiler function, it kinda works:
if( params.path.match(/.html$/) ) {
params.data = "module.exports = function() { return " + JSON.stringify(params.data) + ";};";
return callback(null, this.config.modules.wrapper(params.path, params.data));
}
..but I couldn't resolve all the issues. Pretty much all problems have to do with this line in the compiler function: return callback(null, null);. When I 'reject' a file next plugin gets something undefined and breaks...
Any ideas how to solve this?
I'd like to eventually expand plugin's functionality to handle static assets too, for example copy lib\images\placeholder-1.jpg (but not placeholder-2.jpg) from library if it's used in html files, but I'm stuck at this point...
Here's the code of the plugin:
var CodeLibrary;
module.exports = CodeLibrary = (function() {
var required = [];
CodeLibrary.prototype.brunchPlugin = true;
function CodeLibrary(config) {
this.config = config;
this.pattern = /.*/;
this.watched = this.config.paths.watched.filter(function(path) {
return !path.match( config.plugins.library.pattern );
});
}
function is_required(path) {
var name = this.config.modules.nameCleaner(path);
return required.some(function(e, i, a) { return name.match(e); });
}
function in_library(path) {
return Boolean(path.match( this.config.plugins.library.pattern ));
}
function is_watched(path) {
return this.watched.some(function(e, i, a) { return path.match( e ); });
}
CodeLibrary.prototype.lint = function(data, path, callback) {
if( !is_watched.apply(this, [path]) &&
!is_required.apply(this, [path]) )
return callback();
var es6_pattern = /import .*'(.*)'/gm;
var commonjs_pattern = /require\('(.*)'\)/gm;
var match = es6_pattern.exec(data) || commonjs_pattern.exec(data);
while( match != null ) {
if( required.indexOf(match[1]) === -1 )
required.push( match[1] );
match = es6_pattern.exec(data) || commonjs_pattern.exec(data);
}
callback();
}
CodeLibrary.prototype.compile = function(params, callback) {
if( is_required.apply(this, [params.path]) ||
!in_library.apply(this, [params.path]) )
return callback(null, params);
return callback(null, null);
};
return CodeLibrary;
})();