Показать сообщение отдельно
  #2 (permalink)  
Старый 23.02.2018, 16:56
Профессор
Отправить личное сообщение для Manyasha Посмотреть профиль Найти все сообщения от Manyasha
 
Регистрация: 21.09.2015
Сообщений: 196

vospa, здравствуйте. В этом расширении можно и html и js и стили писать?
Так подойдет?
<head>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
<style>
.button_color {
  width: 60px;
}

.fa-cog {
  float: right;
  font-size: 14px;
  color: #5f5f5f;
  opacity: 0.5;
}

.fa-cog:hover {
  font-size: 16px;
  opacity: 1;
}
</style>

<script>
$(function() {
  $(".button_color").each(function() {
    if (localStorage.getItem(this.id)) {
      $(this).contents().eq(0).replaceWith(localStorage.getItem(this.id))
    }
  });

  $(".fa-cog").click(function(e) {
    e.stopPropagation();
    var x = prompt("Введите имя для кнопки");
    if (x) {
      $(this).parent().contents().eq(0).replaceWith(x);
      localStorage[$(this).parent().attr("id")] = x;
    }
  });
})
</script>
</head>
<body>
  <button class="button_color" id="Cb1">A1<i class="fa fa-cog"></i></button>
  <button class="button_color" id="Cb2">A2<i class="fa fa-cog"></i></button>
  <button class="button_color" id="Cb3">A3<i class="fa fa-cog"></i></button>
  <button class="button_color" id="Cb4">A4<i class="fa fa-cog"></i></button>
</body>
Ответить с цитированием