Browse Source

Resolved: #5874 Unify Blazor UI Framework JavaScripts

pull/5879/head
Halil İbrahim Kalkan 6 years ago
parent
commit
c7e564b736
  1. 35
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/wwwroot/abp_theming.js
  2. 2
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpUtilsService.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IAbpUtilsService.cs
  4. 38
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/abp.js

35
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/wwwroot/abp_theming.js

@ -1,35 +0,0 @@
var abp = abp || {};
(function () {
abp.utils = abp.utils || {};
abp.utils.addClassToTag = function (tagName, className) {
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++) {
tags[i].classList.add(className);
}
};
abp.utils.removeClassFromTag = function (tagName, className) {
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++) {
tags[i].classList.remove(className);
}
};
abp.utils.hasClassOnTag = function (tagName, className) {
var tags = document.getElementsByTagName(tagName);
if (tags.length) {
return tags[0].classList.contains(className);
}
return false;
};
abp.utils.replaceLinkHrefById = function (linkId, hrefValue) {
var link = document.getElementById(linkId);
if (link && link.href !== hrefValue) {
link.href = hrefValue;
}
};
})();

2
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/AbpUtilsService.cs → framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpUtilsService.cs

@ -2,7 +2,7 @@
using Microsoft.JSInterop;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
public class AbpUtilsService : IAbpUtilsService, ITransientDependency
{

2
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/IAbpUtilsService.cs → framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/IAbpUtilsService.cs

@ -1,6 +1,6 @@
using System.Threading.Tasks;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
public interface IAbpUtilsService
{

38
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/abp.js

@ -1,6 +1,9 @@
var abp = abp || {};
(function () {
abp.utils = abp.utils || {};
// COOKIES ///////////////////////////////////////////////////////
/**
* Sets a cookie value for given key.
* This is a simple implementation created to be used by ABP.
@ -77,4 +80,37 @@
document.cookie = cookieValue;
}
})();
// DOM MANIPULATION
abp.utils.addClassToTag = function (tagName, className) {
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++) {
tags[i].classList.add(className);
}
};
abp.utils.removeClassFromTag = function (tagName, className) {
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++) {
tags[i].classList.remove(className);
}
};
abp.utils.hasClassOnTag = function (tagName, className) {
var tags = document.getElementsByTagName(tagName);
if (tags.length) {
return tags[0].classList.contains(className);
}
return false;
};
abp.utils.replaceLinkHrefById = function (linkId, hrefValue) {
var link = document.getElementById(linkId);
if (link && link.href !== hrefValue) {
link.href = hrefValue;
}
};
})();

Loading…
Cancel
Save