• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala HTMLElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Scala中org.scalajs.dom.raw.HTMLElement的典型用法代码示例。如果您正苦于以下问题:Scala HTMLElement类的具体用法?Scala HTMLElement怎么用?Scala HTMLElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了HTMLElement类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。

示例1: TargetService

//设置package包名称以及导入依赖的类
package org.danielnixon.progressive.services

import org.danielnixon.progressive.extensions.dom.ElementWrapper
import org.danielnixon.progressive.shared.api.{ CssClasses, DataAttributes, Target }
import org.scalajs.dom.html
import org.danielnixon.saferdom.implicits._
import org.scalajs.dom.raw.{ Element, HTMLElement }

class TargetService {
  def getTargetElement(element: Element, target: Target): Option[html.Element] = {
    val targetElement = target match {
      case Target.Next => element.nextElementSiblingOpt
      case Target.Parent => Some(element).collect({ case e: HTMLElement => e }).flatMap(_.parentElementOpt)
      case Target.ChildTarget => element.querySelectorOpt(s".${CssClasses.target}")
      case Target.ClosestRefresh => element.closest(s"[${DataAttributes.refresh}]")
    }

    targetElement collect {
      case htmlElement: html.Element => htmlElement
    }
  }
} 
开发者ID:danielnixon,项目名称:progressive,代码行数:23,代码来源:TargetService.scala


示例2: Infinite

//设置package包名称以及导入依赖的类
package org.rebeam.tree.view.infinite

import chandu0101.macros.tojs.JSMacro
import japgolly.scalajs.react._
import org.scalajs.dom.raw.HTMLElement

import scala.scalajs.js
import scala.scalajs.js.JSConverters.JSRichGenTraversableOnce

case class Infinite(handleScroll: js.UndefOr[HTMLElement => Callback] = js.undefined,
                         preloadAdditionalHeight: js.UndefOr[Int] = js.undefined,
                         isInfiniteLoading: js.UndefOr[Boolean] = js.undefined,
                         preloadBatchSize: js.UndefOr[Int] = js.undefined,
                         containerHeight: js.UndefOr[Int] = js.undefined,
                         ref: js.UndefOr[InfiniteM => Unit] = js.undefined,
                         loadingSpinnerDelegate: js.UndefOr[ReactElement] = js.undefined,
                         timeScrollStateLastsForAfterUserScrolls: js.UndefOr[Int] = js.undefined,
                         elementHeight: Double,
                         key: js.UndefOr[String] = js.undefined,
                         className: js.UndefOr[String] = js.undefined,
                         infiniteLoadBeginBottomOffset: js.UndefOr[Int] = js.undefined,
                         onInfiniteLoad: js.UndefOr[Callback] = js.undefined,
                         useWindowAsScrollContainer: js.UndefOr[Boolean] = js.undefined) {

  def apply(children: Seq[ReactElement]) = {
    val props = JSMacro[Infinite](this)
    val f = React.asInstanceOf[js.Dynamic].createFactory(js.Dynamic.global.Infinite)
    f(props, children.toJSArray).asInstanceOf[ReactComponentU_]
  }
}

@js.native
trait InfiniteM extends js.Object {
  def getScrollTop(): Double = js.native
} 
开发者ID:trepidacious,项目名称:tree-material-ui,代码行数:36,代码来源:Infinite.scala


示例3: BasicTag

//设置package包名称以及导入依赖的类
package net.magik6k.simpletags

import org.scalajs.dom._
import org.scalajs.dom.raw.HTMLElement

abstract class BasicTag(tagName: String, inner: Tag*) extends Tag(inner: _*) {
  val element = document.createElement(tagName)
  inner.foreach(tag => element.appendChild(tag.getNode))

  override def getNode: Node = element
  def withClass(clazz: String) = {
    element.classList.add(clazz)
    this
  }

  def css(toSet: (String, String)*) = {
    toSet.foreach{
      case (name: String, value: String) =>
        element.asInstanceOf[HTMLElement].style.setProperty(name, value)
    }
    this
  }

  def setVisible(visible: Boolean) = visible match {
    case true => element.asInstanceOf[HTMLElement].style.setProperty("visibility", "visible")
    case false => element.asInstanceOf[HTMLElement].style.setProperty("visibility", "hidden")
  }
} 
开发者ID:magik6k,项目名称:simpletags,代码行数:29,代码来源:BasicTag.scala


示例4: Paths

//设置package包名称以及导入依赖的类
package org.pragmas.OxShow

import macrocompat.bundle
import scala.scalajs.js.JSApp
import scala.scalajs.js.annotation._
import org.scalajs.dom.raw.HTMLElement
import org.scalajs.dom
import scalatags.JsDom.all._

object Paths {
  val origin = dom.window.location.origin
  val public = s"${origin}/public"
  val defs = s"${public}/defs"
}

object MainApp extends JSApp {

  var container: HTMLElement = _

  def preparePage(defJson: String): Unit = {
    val ddp = new DocumentDefinitionParser(defJson)
    val dp = new DocumentProducer(ddp.doc)
    val dpc = div(cls:="document-producer-container").render    
    this.container.appendChild(dpc)
    dp.pageContent(dpc)
  }

  @JSExport
  def load(id: String, document: String) = {
    this.container = dom.document.getElementById(id).asInstanceOf[HTMLElement]
    preparePage(document)
  }

  def main() : Unit = {
  }

} 
开发者ID:minimalprocedure,项目名称:OxShow,代码行数:38,代码来源:MainApp.scala


示例5: Dropdown

//设置package包名称以及导入依赖的类
package scalafiddle.client.component

import japgolly.scalajs.react._
import org.scalajs.dom
import org.scalajs.dom.raw.{HTMLElement, MouseEvent}
import scalajs.js

object Dropdown {
  import japgolly.scalajs.react.vdom.all._

  case class State(isOpen: Boolean = false)

  case class Props(classes: String, buttonContent: VdomNode, content: (() => Callback) => VdomNode)

  case class Backend($ : BackendScope[Props, State]) {
    def render(props: Props, state: State) = {
      div(cls := s"ui dropdown ${props.classes} ${if (state.isOpen) "active visible" else ""}", onClick ==> {
        (e: ReactEventFromHtml) =>
          dropdownClicked(e, state.isOpen)
      })(
        props.buttonContent,
        props.content(closeDropdown).when(state.isOpen)
      )
    }

    val closeFn: js.Function1[MouseEvent, _] = (e: MouseEvent) => closeDropdown(e)

    def dropdownClicked(e: ReactEventFromHtml, isOpen: Boolean): Callback = {
      if (!isOpen) {
        Callback {
          dom.document.addEventListener("click", closeFn)
        } >> $.modState(s => s.copy(isOpen = true))
      } else {
        Callback.empty
      }
    }

    def closeDropdown(e: MouseEvent): Unit = {
      val state = $.state.runNow()
      val node  = $.getDOMNode.runNow().asInstanceOf[HTMLElement]
      if (state.isOpen && !node.contains(e.target.asInstanceOf[HTMLElement])) {
        closeDropdown().runNow()
      }
    }

    def closeDropdown(): Callback = {
      dom.document.removeEventListener("click", closeFn)
      $.modState(s => s.copy(isOpen = false))
    }
  }

  val component = ScalaComponent
    .builder[Props]("FiddleEditor")
    .initialState(State())
    .renderBackend[Backend]
    .build

  def apply(classes: String, buttonContent: VdomNode)(content: (() => Callback) => VdomNode) =
    component(Props(classes, buttonContent, content))
} 
开发者ID:scalafiddle,项目名称:scalafiddle-editor,代码行数:61,代码来源:Dropdown.scala


示例6: propOne

//设置package包名称以及导入依赖的类
package spatutorial.client.components

import japgolly.scalajs.react.vdom.prefix_<^.<
import japgolly.scalajs.react.{BackendScope, Callback, JsComponentM, JsComponentType, JsComponentU, ReactComponentB, ReactComponentU_, ReactNode}
import org.scalajs.dom.raw.HTMLElement

import scala.scalajs.js
import scala.scalajs.js._
import scala.scalajs.js.annotation.JSName

@js.native
trait SampleReactComponentProps extends js.Object {
  def propOne: String = js.native
  def propRwo: String = js.native
}

@js.native
@JSName("SampleReactComponent")
class SampleReactComponent(props: SampleReactComponentProps) extends JsComponentU[SampleReactComponentProps, js.Object, HTMLElement]

object SampleReactComponentProps {
  def apply(propOne: String,
            propTwo: String): SampleReactComponentProps = {
    js.Dynamic.literal(
      propOne = propOne,
      propYwo = propTwo
    ).asInstanceOf[SampleReactComponentProps]
  }
}

object SampleReactComponent {

  //  ,^.style("width: 500; height: 500")
  val component = ReactComponentB[SampleReactComponentProps]("SampleReactComponent")
    .render_P(p => new SampleReactComponent(p))
    .build

  //  val component = ReactComponentB[AceProps]("AceEditor")
  //    //.render(p => new AceEditor(p))
  //    .render_P(p => new AceEditor(p))
  //    .build

  def apply(props: SampleReactComponentProps, children: ReactNode*) = component(props, children: _*)

  def apply() = component

} 
开发者ID:wrotki,项目名称:spacommander,代码行数:48,代码来源:SampleReactComponent.scala


示例7: element

//设置package包名称以及导入依赖的类
package se.lu.nateko.cp.doi.gui.widgets.generic

import org.scalajs.dom.html
import scalatags.JsDom.all._
import org.scalajs.dom.raw.HTMLElement
import se.lu.nateko.cp.doi.gui.views.Constants

trait EntityWidget[E]{
	def element: html.Element
	protected def updateCb: E => Unit

	def highlightError(elem: HTMLElement, errorOpt: Option[String]): Unit = errorOpt match{
		case Some(err) =>
			elem.title = err
			elem.style.background = Constants.errorInputBackground
		case None =>
			elem.title = ""
			elem.style.background = ""
	}
} 
开发者ID:ICOS-Carbon-Portal,项目名称:doi,代码行数:21,代码来源:EntityWidget.scala


示例8: Runtime

//设置package包名称以及导入依赖的类
package com.olegych.scastie.api
package runtime

import play.api.libs.json.Json

import org.scalajs.dom.raw.HTMLElement

import java.util.UUID

import java.awt.image.BufferedImage

import scala.reflect.ClassTag

object Runtime extends SharedRuntime {
  def write(in: Either[Option[RuntimeError], List[Instrumentation]]): String = {
    Json.stringify(Json.toJson(ScalaJsResult(in)))
  }
  def render[T: ClassTag](a: T, attach: HTMLElement => UUID): Render = {
    a match {
      case element: HTMLElement => {
        val uuid = attach(element)
        AttachedDom(uuid.toString)
      }
      case _ => super.render(a)
    }
  }

  def image(path: String): Html =
    throw new Exception("image(path: String): Html works only on the jvm")

  def toBase64(in: BufferedImage): Html =
    throw new Exception(
      "toBase64(in: BufferedImage): Html works only on the jvm"
    )
} 
开发者ID:scalacenter,项目名称:scastie,代码行数:36,代码来源:Runtime.scala


示例9: attach

//设置package包名称以及导入依赖的类
package com.olegych.scastie.api
package runtime

import org.scalajs.dom.raw.HTMLElement
import scala.scalajs.js

import scala.collection.mutable.Buffer

import java.util.UUID

trait DomHook {
  private val elements = Buffer.empty[HTMLElement]

  def attach(element: HTMLElement): UUID = {
    val uuid = UUID.randomUUID()
    element.setAttribute("uuid", uuid.toString)
    elements += element
    uuid
  }

  def attachedElements(): js.Array[HTMLElement] = elements.to[js.Array]
} 
开发者ID:scalacenter,项目名称:scastie,代码行数:23,代码来源:DomHook.scala


示例10: Page

//设置package包名称以及导入依赖的类
package autosteamgifts.background.options

import autosteamgifts.Implicits._
import org.scalajs.dom.window
import org.scalajs.dom.raw.{Document, HTMLAnchorElement, HTMLElement, HTMLInputElement, HTMLSelectElement}

class Page(document: Document) {
  lazy val form = document.getElementById("form")

  lazy val checkEnableElement = document.query[HTMLInputElement]("#check-enabled")
  lazy val checkIntervalElement = document.query[HTMLSelectElement]("#check-interval")
  lazy val checkActions = document.query[HTMLElement]("#check-actions")

  lazy val hideGamesEnableElement = document.query[HTMLInputElement]("#hide-games")
  lazy val hideGamesBelowPercentRatingElement = document.query[HTMLInputElement]("#hide-games-percent")

  lazy val autoEnterGiveawaysEnableElement = document.query[HTMLInputElement]("#enter-giveaways")

  lazy val notifyEnableElement = document.query[HTMLInputElement]("#notify-ending-giveaways")
  lazy val notifyTimeAmountElement = document.query[HTMLSelectElement]("#notify-time-amount")

  lazy val hideFeaturedGiveawayElement = document.query[HTMLInputElement]("#hide-featured-giveaway")
  lazy val hidePinnedGiveawaysElement = document.query[HTMLInputElement]("#hide-pinned-giveaways")
  lazy val hideActiveDiscussionsElement = document.query[HTMLInputElement]("#hide-active-discussions")

  lazy val repositionIconsElement = document.query[HTMLInputElement]("#reposition-icons")
  lazy val streamlineHidingElement = document.query[HTMLInputElement]("#streamline-hiding")
  lazy val includeEnterButtonElement = document.query[HTMLInputElement]("#include-enter-button")
  lazy val includeRating = document.query[HTMLInputElement]("#include-rating")

  lazy val allInputElements = document.queryAll[HTMLInputElement]("input,select")

  lazy val resourceSavingTipElement = document.query[HTMLElement]("#resource-saving-tip")
  lazy val resourceSavingTipToggleElement = document.query[HTMLElement]("#resource-saving-tip-toggle")

  lazy val hiddenGamesTipElement = document.query[HTMLElement]("#hidden-games-tip")
  lazy val hiddenGamesTipToggleElement = document.query[HTMLElement]("#hidden-games-tip-toggle")

  lazy val streamlineHidingTipElement = document.query[HTMLElement]("#streamline-hiding-tip")
  lazy val streamlineHidingTipToggleElement = document.query[HTMLElement]("#streamline-hiding-tip-toggle")

  lazy val steamGiftsGiveawaysSettingsElements = document.queryAll[HTMLAnchorElement](".steamgifts-giveaways-settings")

  lazy val submitButton = form.query[HTMLInputElement]("input[type='submit'")
  lazy val optionsNotSavedMsgElement = document.query[HTMLElement]("#options-not-saved-msg")
  private lazy val optionsSavedMsgElement = document.query[HTMLElement]("#options-saved-msg")

  def showSavedMsg(): Unit = {
    optionsSavedMsgElement.classList.remove("hidden")

    window.setTimeout({ () =>
      optionsSavedMsgElement.classList.add("hidden")
    }, 1)
  }
} 
开发者ID:erdavila,项目名称:auto-steamgifts,代码行数:56,代码来源:Page.scala


示例11: GiveawaysListing

//设置package包名称以及导入依赖的类
package autosteamgifts.contentscript.listing

import autosteamgifts.Implicits._
import org.scalajs.dom.raw.{Document, HTMLElement}

class GiveawaysListing(document: Document) extends autosteamgifts.GiveawaysListing(document) {

  override def giveaways: Seq[Giveaway] = giveawaysElements.map(new Giveaway(_))

  private lazy val rangeElement = document.query[HTMLElement](".pagination__results > strong:nth-child(2)")

  lazy val featuredGiveawayElement = document.query[HTMLElement](".featured__container")
  lazy val activeDiscussionsElement = document.query[HTMLElement](".widget-container.widget-container--margin-top")

  def removeGiveawaysByGameId(id: String): Unit = {
    val giveawaysToRemove = giveaways.filter { _.game.id == id }
    for (giveaway <- giveawaysToRemove) {
      giveaway.setElementEliminationTransition()
    }
    decrementRange(giveawaysToRemove.length)
  }

  private def decrementRange(n: Int): Unit = {
    rangeElement.textContent = (rangeElement.textContent.toInt - n).toString
  }

  def points_=(points: Int): Unit = {
    pointsElement.textContent = points.toString()
    for (giveaway <- giveaways; enterButton <- giveaway.enterButton if !enterButton.isLoading) {
      enterButton.update(username, userLevel, points)
    }
  }
} 
开发者ID:erdavila,项目名称:auto-steamgifts,代码行数:34,代码来源:GiveawaysListing.scala


示例12: Giveaway

//设置package包名称以及导入依赖的类
package autosteamgifts.contentscript.giveaway

import autosteamgifts.{Game, GameRatingDisplay}
import autosteamgifts.Implicits._
import org.scalajs.dom.ext.Color
import org.scalajs.dom.raw.{HTMLAnchorElement, HTMLDocument, HTMLElement, HTMLImageElement, HTMLInputElement}

class Giveaway(document: HTMLDocument) {
  private lazy val containerElement = document.query[HTMLElement](".featured__container")

  lazy val headingElement = containerElement.query[HTMLElement](".featured__heading")
  private lazy val sideBarElement = document.query[HTMLElement](".sidebar--wide")

  lazy val xsrfToken = sideBarElement.query[HTMLInputElement]("[name='xsrf_token']").value
  lazy val enterButton = Option(sideBarElement.query[HTMLElement](".sidebar__entry-insert"))
  lazy val leaveButton = Option(sideBarElement.query[HTMLElement](".sidebar__entry-delete"))

  lazy val game = {
    val id = containerElement.query[HTMLElement]("[data-game-id]").getAttribute("data-game-id")
    val name = containerElement.query[HTMLElement](".featured__heading__medium").textContent
    val steamUrl = Option(containerElement.query[HTMLAnchorElement]("[href*='steampowered.com/']")).map(_.href)
    val imageUrl = Option(containerElement.query[HTMLImageElement](".global__image-outer-wrap img")) map { el =>
      el.src
    }
    new Game(id, name, steamUrl, imageUrl)
  }

  def displayRating(ratingDisplay: GameRatingDisplay): Unit = {
    val BackgroundColor = Color(240, 242, 245)

    headingElement.appendChild {
      val ratingElement = document.createElement("div").asInstanceOf[HTMLElement]
      ratingElement.title = "Rating"
      ratingElement.className = "featured__column"
      ratingElement.textContent = ratingDisplay.formatted
      ratingElement.style.color = ratingDisplay.color
      ratingElement.style.backgroundColor = BackgroundColor
      ratingElement
    }
  }
} 
开发者ID:erdavila,项目名称:auto-steamgifts,代码行数:42,代码来源:Giveaway.scala


示例13: GiveawaysListing

//设置package包名称以及导入依赖的类
package autosteamgifts

import autosteamgifts.Implicits._
import org.scalajs.dom.raw.{Document, HTMLAnchorElement, HTMLElement, HTMLInputElement}
import scala.scalajs.js

class GiveawaysListing(document: Document) {
  lazy val hideGamePopupElement = document.querySelector(".popup--hide-games")
  lazy val xsrfToken = hideGamePopupElement.query[HTMLInputElement]("""input[name="xsrf_token"]""").value

  protected lazy val pointsElement = document.query[HTMLElement](".nav__points")

  lazy val username = {
    val RE = js.RegExp("""/([^/]+)(?:\?.+)?$""")
    val userProfileLink = document.query[HTMLAnchorElement](".nav__avatar-outer-wrap").href
    RE.exec(userProfileLink)(1).get
  }

  lazy val userLevel = {
    val RE = js.RegExp("""^Level (\d+)$""")
    val userLevelElement = pointsElement.parentElement.lastElementChild
    RE.exec(userLevelElement.textContent)(1).get.toInt
  }

  def points: Int = pointsElement.textContent.toInt

  lazy val pinnedGiveawaysElement = Option(document.query[HTMLElement](".pinned-giveaways__outer-wrap"))
  protected def giveawaysElements = document.queryAll[HTMLElement](".giveaway__row-outer-wrap")
  def giveaways: Seq[Giveaway] = giveawaysElements map { new Giveaway(_) }

  lazy val hasLinkToNextPage = {
    val divNavigationOrNull = document.query[HTMLElement](".pagination__navigation")
    Option(divNavigationOrNull) map { divNavigation =>
      val linkToNextOrSelf = divNavigationOrNull.lastChild.asInstanceOf[HTMLAnchorElement]
      val linkTextElement = linkToNextOrSelf.firstChild.asInstanceOf[HTMLElement]
      linkTextElement.textContent == "Next"
    } getOrElse false
  }
} 
开发者ID:erdavila,项目名称:auto-steamgifts,代码行数:40,代码来源:GiveawaysListing.scala


示例14: Giveaway

//设置package包名称以及导入依赖的类
package autosteamgifts

import autosteamgifts.Implicits._
import autosteamgifts.TimeAmount._
import org.scalajs.dom.raw.{HTMLAnchorElement, HTMLElement}
import scala.scalajs.js

class Giveaway(element: HTMLElement) {
  protected lazy val innerElement = element.firstElementChild
  lazy val headingElement = element.query[HTMLAnchorElement](".giveaway__heading")
  protected lazy val headingNameElement = headingElement.query[HTMLAnchorElement](".giveaway__heading__name")

  lazy val url = {
    val href = headingNameElement.getAttribute("href")
    if (href.startsWith("/")) URLs.SteamGiftsBaseUrl + href else href
  }
  lazy val code = URLs.giveawayCodeFromUrl(url)

  lazy val game = {
    val id = element.getAttribute("data-game-id")
    val name = headingNameElement.textContent
    val steamUrl = Option(element.query[HTMLAnchorElement]("[href*='steampowered.com/']")).map(_.href)
    val imageUrl = Option(element.query[HTMLElement](".giveaway_image_thumbnail")) map { el =>
      val Prefix = "url(\""
      val Suffix = "\")"
      val bgImg = el.style.backgroundImage
      assert(bgImg.startsWith(Prefix))
      assert(bgImg.endsWith(Suffix))
      bgImg.drop(Prefix.length()).dropRight(Suffix.length())
    }
    new Game(id, name, steamUrl, imageUrl)
  }

  lazy val minUserLevel = {
    val RE = js.RegExp("""^Level (\d+)\+$""")
    val minUserLevelElement = Option(element.query[HTMLElement](".giveaway__column--contributor-level"))
    minUserLevelElement.fold(0) { el =>
      RE.exec(el.textContent)(1).get.toInt
    }
  }

  lazy val requiredPoints = {
    val RE = js.RegExp("""^\((\d+)P\)$""")
    val pointsElement = element.queryAll[HTMLElement](".giveaway__heading__thin").last
    RE.exec(pointsElement.textContent)(1).get.toInt
  }

  lazy val timeRemaining = {
    val timeRemainingElement = element.query[HTMLElement]("[data-timestamp]")
    val endTimestamp = timeRemainingElement.getAttribute("data-timestamp").toInt
    (endTimestamp - js.Date.now() / 1000).toInt.seconds
  }

  lazy val giverUsername = element.query[HTMLElement](".giveaway__username").textContent

  def hidingElement: Option[HTMLElement] = Option(headingElement.query[HTMLElement](".giveaway__icon[data-popup='popup--hide-games']"))

  protected val EnteredClassName = "is-faded"

  def entered: Boolean = innerElement.classList.contains(EnteredClassName)
} 
开发者ID:erdavila,项目名称:auto-steamgifts,代码行数:62,代码来源:Giveaway.scala


示例15: Tooltip

//设置package包名称以及导入依赖的类
package com.mogproject.mogami.playground.view.bootstrap

import com.mogproject.mogami.util.Implicits._
import org.scalajs.dom
import org.scalajs.dom.Element
import org.scalajs.dom.raw.HTMLElement
import org.scalajs.jquery.{JQuery, jQuery}

import scala.scalajs.js


object Tooltip {
  def enableHoverToolTip(isMobile: Boolean): Unit = enableHoverToolTip(jQuery("""[data-toggle="tooltip"]"""), isMobile)

  def enableHoverToolTip(elems: Seq[HTMLElement]): Unit = elems.foreach(e => enableHoverToolTip(jQuery(e)))

  def enableHoverToolTip(jQuery: JQuery, isMobile: Boolean = false): Unit = {
    jQuery.asInstanceOf[BootstrapJQuery].tooltip {
      val r = js.Dynamic.literal()
      r.trigger = isMobile.fold("focus", "hover")
      r.asInstanceOf[TooltipOptions]
    }
  }

  def hideAllToolTip(): Unit = {
    jQuery("""[data-toggle="tooltip"]""").asInstanceOf[BootstrapJQuery].tooltip("hide")
  }

  def display(elem: Element, message: String, displayTime: Int = 1000): Unit = {
    jQuery(elem).attr("data-original-title", message).asInstanceOf[BootstrapJQuery].tooltip("show")
    val f = () => jQuery(elem).asInstanceOf[BootstrapJQuery].tooltip("hide").attr("data-original-title", "")
    dom.window.setTimeout(f, displayTime)
  }
} 
开发者ID:mogproject,项目名称:mog-playground,代码行数:35,代码来源:Tooltip.scala


示例16: main

//设置package包名称以及导入依赖的类
package org.hyperscala

import org.scalajs.dom.raw.HTMLElement

trait SimpleClientScreen[Main <: HTMLElement] extends ClientScreen with SimpleScreen {
  def main: Main

  protected def isReplace: Boolean = false

  override protected def activate(url: URL): Option[URLChange] = {
    logger.debug(s"activate $toString, $path")
    main.style.display = "block"
    Some(URLChange(url.copy(path = path), isReplace))
  }

  override protected def deactivate(): Unit = {
    logger.debug(s"deactivate $toString")
    main.style.display = "none"
  }
} 
开发者ID:outr,项目名称:hyperscala,代码行数:21,代码来源:SimpleClientScreen.scala


示例17: Polymer

//设置package包名称以及导入依赖的类
package example.polymer

import org.scalajs.dom.raw.{HTMLElement, MouseEvent}

import scala.scalajs.js
import scala.scalajs.js.annotation.{JSExport, JSExportDescendentObjects, JSName, ScalaJSDefined}

@js.native
object Polymer extends js.Object {
  def apply(prototype: Dynamic): js.Dynamic = js.native
}

@ScalaJSDefined
abstract class PolymerElement extends PolymerBase {
  def is: String
  def properties: js.Dynamic
}

@ScalaJSDefined
trait PolymerLifeCycle extends js.Object {
  def beforeRegister(): Unit
  def created(): Unit
  def ready(): Unit
  def attached(): Unit
  def detached(): Unit
}

@ScalaJSDefined
trait PolymerAttrObserver extends js.Object {
  def attributeChanged(aName: String, aType: String): Unit
}

@js.native
@JSName("Polymer.Base")
abstract class PolymerBase extends HTMLElement with PolymerLifeCycle with PolymerAttrObserver

@JSExportDescendentObjects
trait PolymerApplication {
  @JSExport
  def bootstrap(): Unit
} 
开发者ID:ruud,项目名称:scala-js-polymer,代码行数:42,代码来源:PolymerBase.scala



注:本文中的org.scalajs.dom.raw.HTMLElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala HttpRequest类代码示例发布时间:2022-05-23
下一篇:
Scala Request类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap